8c6d56b27c
K-Fêt - Integrate wagtail to serve "static" pages of old K-Fêt website - Fixture "kfetcms/kfet_wagtail_17_05" contains a copy of old website (as in May 2017). - Media files can be got until end of June 17 at http://partage.eleves.ens.fr//files/604e6dea2ceebc66b1936c6b3f911744/kfet_media.tar.gz Login/logout - Update package django_cas_ng to last version. - Clean COFCASBackend. - Change CAS version to 3 (version used on eleves.ens). This enables the logout redirection (for CAS ofc). - Add messages and clean existing ones on login/logout (for both outsider and cas users). Misc - Update settings to bypass an incompability between debug-toolbar and wagtailmenus packages. - Better management of dev/test-specific urls (if debug-toolbar wasn't in INSTALLED_APPS, media files were not served). - UI improvements.
23 lines
773 B
Python
23 lines
773 B
Python
from django.contrib import messages
|
|
from django.contrib.auth.signals import user_logged_in
|
|
from django.dispatch import receiver
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from django_cas_ng.signals import cas_user_authenticated
|
|
|
|
|
|
@receiver(user_logged_in)
|
|
def messages_on_out_login(request, user, **kwargs):
|
|
if user.backend.startswith('django.contrib.auth'):
|
|
msg = _('Connexion à GestioCOF réussie. Bienvenue {}.').format(
|
|
user.get_short_name(),
|
|
)
|
|
messages.success(request, msg)
|
|
|
|
|
|
@receiver(cas_user_authenticated)
|
|
def mesagges_on_cas_login(request, user, **kwargs):
|
|
msg = _('Connexion à GestioCOF par CAS réussie. Bienvenue {}.').format(
|
|
user.get_short_name(),
|
|
)
|
|
messages.success(request, msg)
|