# -*- coding: utf-8 -*-

from __future__ import (absolute_import, division,
                        print_function, unicode_literals)
from builtins import *

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

@receiver(user_logged_in)
def messages_on_login(sender, request, user, **kwargs):
    if (not user.username == 'kfet_genericteam'
            and user.has_perm('kfet.is_team')):
        messages.info(request, '<a href="%s">Connexion en utilisateur partagé ?</a>' % reverse('kfet.login.genericteam'), extra_tags='safe')
