diff --git a/cas_server/locale/en/LC_MESSAGES/django.mo b/cas_server/locale/en/LC_MESSAGES/django.mo index c030729..17ed871 100644 Binary files a/cas_server/locale/en/LC_MESSAGES/django.mo and b/cas_server/locale/en/LC_MESSAGES/django.mo differ diff --git a/cas_server/locale/en/LC_MESSAGES/django.po b/cas_server/locale/en/LC_MESSAGES/django.po index 6a96f79..299bc72 100644 --- a/cas_server/locale/en/LC_MESSAGES/django.po +++ b/cas_server/locale/en/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: cas_server\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-17 19:21+0100\n" -"PO-Revision-Date: 2015-12-17 19:22+0100\n" +"POT-Creation-Date: 2015-12-26 15:31+0100\n" +"PO-Revision-Date: 2015-12-26 15:34+0100\n" "Last-Translator: Valentin Samir \n" "Language-Team: django \n" "Language: en\n" @@ -92,6 +92,9 @@ msgid "" "some\\.server\\.com/path/.*$'.As it is a regular expression, special " "character must be escaped with a '\\'." msgstr "" +"A regular expression matching services. Will usually looks like '^https://" +"some\\.server\\.com/path/.*$'.As it is a regular expression, special " +"character must be escaped with a '\\'." #: models.py:198 msgid "user field" @@ -210,7 +213,7 @@ msgstr "" #: templates/cas_server/logged.html:10 msgid "Log me out from all my sessions" -msgstr "" +msgstr "Log me out from all my sessions" #: templates/cas_server/logged.html:13 msgid "Logout" @@ -224,54 +227,80 @@ msgstr "Please loggin" msgid "Login" msgstr "Login" -#: templates/cas_server/logout.html:6 views.py:123 -msgid "Successfully logout" -msgstr "" -"

Logout successful

You have successfully logged out of the Central " -"Authentication Service.
For security reasons, exit your web browser." - #: templates/cas_server/warn.html:7 msgid "Connect to the service" msgstr "Connect to the service" -#: views.py:197 +#: views.py:128 +msgid "" +"

Logout successful

You have successfully logged out from the Central " +"Authentication Service. For security reasons, exit your web browser." +msgstr "" +"

Logout successful

You have successfully logged out from the Central " +"Authentication Service. For security reasons, exit your web browser." + +#: views.py:134 +#, python-format +msgid "" +"

Logout successful

You have successfully logged out from %s sessions " +"of the Central Authentication Service. For security reasons, exit your web " +"browser." +msgstr "" +"

Logout successful

You have successfully logged out from %s sessions " +"of the Central Authentication Service. For security reasons, exit your web " +"browser." + +#: views.py:141 +msgid "" +"

Logout successful

You were already logged out from the Central " +"Authentication Service. For security reasons, exit your web browser." +msgstr "" +"

Logout successful

You were already logged out from the Central " +"Authentication Service. For security reasons, exit your web browser." + +#: views.py:230 msgid "Invalid login ticket" msgstr "Invalid login ticket, please retry to login" -#: views.py:292 +#: views.py:325 #, python-format msgid "Authentication has been required by service %(name)s (%(url)s)" msgstr "Authentication has been required by service %(name)s (%(url)s)" -#: views.py:326 +#: views.py:359 #, python-format msgid "Service %(url)s non allowed." msgstr "Service %(url)s non allowed." -#: views.py:333 +#: views.py:366 msgid "Username non allowed" msgstr "Username non allowed" -#: views.py:340 +#: views.py:373 msgid "User charateristics non allowed" msgstr "User charateristics non allowed" -#: views.py:347 +#: views.py:380 #, python-format msgid "The attribut %(field)s is needed to use that service" msgstr "The attribut %(field)s is needed to use that service" -#: views.py:417 +#: views.py:450 #, python-format msgid "Authentication renewal required by service %(name)s (%(url)s)." msgstr "Authentication renewal required by service %(name)s (%(url)s)." -#: views.py:424 +#: views.py:457 #, python-format msgid "Authentication required by service %(name)s (%(url)s)." msgstr "Authentication required by service %(name)s (%(url)s)." -#: views.py:431 +#: views.py:464 #, python-format msgid "Service %s non allowed" msgstr "Service %s non allowed" + +#~ msgid "Successfully logout" +#~ msgstr "" +#~ "

Logout successful

You have successfully logged out of the Central " +#~ "Authentication Service.
For security reasons, exit your web browser." diff --git a/cas_server/locale/fr/LC_MESSAGES/django.mo b/cas_server/locale/fr/LC_MESSAGES/django.mo index d1fab0f..9234289 100644 Binary files a/cas_server/locale/fr/LC_MESSAGES/django.mo and b/cas_server/locale/fr/LC_MESSAGES/django.mo differ diff --git a/cas_server/locale/fr/LC_MESSAGES/django.po b/cas_server/locale/fr/LC_MESSAGES/django.po index 0db5444..a157cbf 100644 --- a/cas_server/locale/fr/LC_MESSAGES/django.po +++ b/cas_server/locale/fr/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: cas_server\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-17 19:21+0100\n" -"PO-Revision-Date: 2015-12-17 19:22+0100\n" +"POT-Creation-Date: 2015-12-26 15:31+0100\n" +"PO-Revision-Date: 2015-12-26 15:34+0100\n" "Last-Translator: Valentin Samir \n" "Language-Team: django \n" "Language: fr\n" @@ -236,61 +236,89 @@ msgstr "Merci de se connecter" msgid "Login" msgstr "Connexion" -#: templates/cas_server/logout.html:6 views.py:123 -msgid "Successfully logout" -msgstr "" -"

Déconnexion réussie

\n" -"Vous vous êtes déconnecté(e) du Service Central d'Authentification.
Pour " -"des raisons de sécurité, veuillez fermer votre navigateur." - #: templates/cas_server/warn.html:7 msgid "Connect to the service" msgstr "Se connecter au service" -#: views.py:197 +#: views.py:128 +msgid "" +"

Logout successful

You have successfully logged out from the Central " +"Authentication Service. For security reasons, exit your web browser." +msgstr "" +"

Déconnexion réussie

Vous vous êtes déconnecté(e) du Service Central " +"d'Authentification. Pour des raisons de sécurité, veuillez fermer votre " +"navigateur." + +#: views.py:134 +#, python-format +msgid "" +"

Logout successful

You have successfully logged out from %s sessions " +"of the Central Authentication Service. For security reasons, exit your web " +"browser." +msgstr "" +"

Déconnexion réussie

Vous vous êtes déconnecté(e) de %s sessions du " +"Service Central d'Authentification. Pour des raisons de sécurité, veuillez " +"fermer votre navigateur." + +#: views.py:141 +msgid "" +"

Logout successful

You were already logged out from the Central " +"Authentication Service. For security reasons, exit your web browser." +msgstr "" +"

Déconnexion réussie

Vous étiez déjà déconnecté(e) du Service Central " +"d'Authentification. Pour des raisons de sécurité, veuillez fermer votre " +"navigateur." + +#: views.py:230 msgid "Invalid login ticket" msgstr "Ticket de connexion invalide, merci de réessayé de vous connecter" -#: views.py:292 +#: views.py:325 #, python-format msgid "Authentication has been required by service %(name)s (%(url)s)" msgstr "" "Une demande d'authentification a été émise pour le service %(name)s " "(%(url)s)." -#: views.py:326 +#: views.py:359 #, python-format msgid "Service %(url)s non allowed." msgstr "le service %(url)s n'est pas autorisé." -#: views.py:333 +#: views.py:366 msgid "Username non allowed" msgstr "Nom d'utilisateur non authorisé" -#: views.py:340 +#: views.py:373 msgid "User charateristics non allowed" msgstr "Caractéristique utilisateur non autorisée" -#: views.py:347 +#: views.py:380 #, python-format msgid "The attribut %(field)s is needed to use that service" msgstr "L'attribut %(field)s est nécessaire pour se connecter à ce service" -#: views.py:417 +#: views.py:450 #, python-format msgid "Authentication renewal required by service %(name)s (%(url)s)." msgstr "Demande de réauthentification pour le service %(name)s (%(url)s)." -#: views.py:424 +#: views.py:457 #, python-format msgid "Authentication required by service %(name)s (%(url)s)." msgstr "Authentification requise par le service %(name)s (%(url)s)." -#: views.py:431 +#: views.py:464 #, python-format msgid "Service %s non allowed" msgstr "Le service %s n'est pas autorisé" +#~ msgid "Successfully logout" +#~ msgstr "" +#~ "

Déconnexion réussie

\n" +#~ "Vous vous êtes déconnecté(e) du Service Central d'Authentification.
Pour des raisons de sécurité, veuillez fermer votre navigateur." + #~ msgid "" #~ "A ProxyGrantingTicket can be delivered to the service in order to " #~ "authenticate for the user on a backend service" diff --git a/cas_server/templates/cas_server/logout.html b/cas_server/templates/cas_server/logout.html index 9de1276..f189866 100644 --- a/cas_server/templates/cas_server/logout.html +++ b/cas_server/templates/cas_server/logout.html @@ -3,6 +3,6 @@ {% load staticfiles %} {% load i18n %} {% block content %} - + {% endblock %} diff --git a/cas_server/views.py b/cas_server/views.py index 6ef944b..273da55 100644 --- a/cas_server/views.py +++ b/cas_server/views.py @@ -64,6 +64,7 @@ class LogoutMixin(object): """destroy CAS session utils""" def logout(self, all=False): """effectively destroy CAS session""" + session_nb = 0 username = self.request.session.get("username") if username: if all: @@ -79,6 +80,7 @@ class LogoutMixin(object): self.request.session.flush() user.logout(self.request) user.delete() + session_nb += 1 except models.User.DoesNotExist: # if user not found in database, flush the session anyway self.request.session.flush() @@ -90,7 +92,9 @@ class LogoutMixin(object): session.flush() user.logout(self.request) user.delete() + session_nb += 1 logger.info("User %s logged out" % username) + return session_nb class LogoutView(View, LogoutMixin): @@ -109,7 +113,7 @@ class LogoutView(View, LogoutMixin): """methode called on GET request on this view""" logger.info("logout requested") self.init_get(request) - self.logout(self.request.GET.get("all")) + session_nb = self.logout(self.request.GET.get("all")) # if service is set, redirect to service after logout if self.service: list(messages.get_messages(request)) # clean messages before leaving the django app @@ -119,20 +123,49 @@ class LogoutView(View, LogoutMixin): return HttpResponseRedirect(self.url) # else redirect to login page else: + if session_nb == 1: + logout_msg = _( + "

Logout successful

" + "You have successfully logged out from the Central Authentication Service. " + "For security reasons, exit your web browser." + ) + elif session_nb > 1: + logout_msg = _( + "

Logout successful

" + "You have successfully logged out from %s sessions of the Central " + "Authentication Service. " + "For security reasons, exit your web browser." + ) % session_nb + else: + logout_msg = _( + "

Logout successful

" + "You were already logged out from the Central Authentication Service. " + "For security reasons, exit your web browser." + ) + if settings.CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT: - messages.add_message(request, messages.SUCCESS, _(u'Successfully logout')) + messages.add_message(request, messages.SUCCESS, logout_msg) if self.ajax: url = reverse("cas_server:login") - data = {'status': 'success', 'detail': 'logout', 'url': url} + data = { + 'status': 'success', + 'detail': 'logout', + 'url': url, + 'session_nb': session_nb + } return JsonResponse(request, data) else: return redirect("cas_server:login") else: if self.ajax: - data = {'status': 'success', 'detail': 'logout'} + data = {'status': 'success', 'detail': 'logout', 'session_nb': session_nb} return JsonResponse(request, data) else: - return render(request, settings.CAS_LOGOUT_TEMPLATE) + return render( + request, + settings.CAS_LOGOUT_TEMPLATE, + {'logout_msg': logout_msg} + ) class LoginView(View, LogoutMixin):