2016-09-10 22:49:07 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from django.contrib import messages
|
|
|
|
from django.contrib.auth.signals import user_logged_in
|
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
from django.dispatch import receiver
|
|
|
|
|
2017-04-15 12:36:11 +02:00
|
|
|
|
2016-09-10 22:49:07 +02:00
|
|
|
@receiver(user_logged_in)
|
|
|
|
def messages_on_login(sender, request, user, **kwargs):
|
2017-04-15 12:36:11 +02:00
|
|
|
if (not user.username == 'kfet_genericteam' and
|
|
|
|
user.has_perm('kfet.is_team') and
|
2017-06-21 07:08:28 +02:00
|
|
|
hasattr(request, 'GET') and
|
2017-04-15 12:36:11 +02:00
|
|
|
'k-fet' in request.GET.get('next', '')):
|
|
|
|
messages.info(
|
|
|
|
request,
|
2017-05-18 20:17:05 +02:00
|
|
|
('<a href="{}" target="_blank">Connexion en utilisateur partagé ?</a>'
|
2017-04-15 12:36:11 +02:00
|
|
|
.format(reverse('kfet.login.genericteam'))),
|
|
|
|
extra_tags='safe')
|