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-06-12 01:51:10 +02:00
|
|
|
from django.utils.safestring import mark_safe
|
2016-09-10 22:49:07 +02:00
|
|
|
|
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', '')):
|
2017-05-30 20:44:30 +02:00
|
|
|
messages.info(request, mark_safe(
|
|
|
|
'<a href="{}" class="genericteam" target="_blank">'
|
|
|
|
' Connexion en utilisateur partagé ?'
|
|
|
|
'</a>'
|
|
|
|
.format(reverse('kfet.login.genericteam'))
|
|
|
|
))
|