Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
django-cas-server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Samir
django-cas-server
Commits
10c53a80
Commit
10c53a80
authored
Dec 26, 2015
by
Valentin Samir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On logout display the number of sessions we are logged out from (none, 1, more).
parent
5e63f39f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
42 deletions
+132
-42
cas_server/locale/en/LC_MESSAGES/django.mo
cas_server/locale/en/LC_MESSAGES/django.mo
+0
-0
cas_server/locale/en/LC_MESSAGES/django.po
cas_server/locale/en/LC_MESSAGES/django.po
+47
-18
cas_server/locale/fr/LC_MESSAGES/django.mo
cas_server/locale/fr/LC_MESSAGES/django.mo
+0
-0
cas_server/locale/fr/LC_MESSAGES/django.po
cas_server/locale/fr/LC_MESSAGES/django.po
+46
-18
cas_server/templates/cas_server/logout.html
cas_server/templates/cas_server/logout.html
+1
-1
cas_server/views.py
cas_server/views.py
+38
-5
No files found.
cas_server/locale/en/LC_MESSAGES/django.mo
View file @
10c53a80
No preview for this file type
cas_server/locale/en/LC_MESSAGES/django.po
View file @
10c53a80
...
...
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: cas_server\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-
17 19:2
1+0100\n"
"PO-Revision-Date: 2015-12-
17 19:22
+0100\n"
"POT-Creation-Date: 2015-12-
26 15:3
1+0100\n"
"PO-Revision-Date: 2015-12-
26 15:34
+0100\n"
"Last-Translator: Valentin Samir <valentin.samir@crans.org>\n"
"Language-Team: django <LL@li.org>\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 ""
"<h3>Logout successful</h3>You have successfully logged out of the Central "
"Authentication Service.</br>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 ""
"<h3>Logout successful</h3>You have successfully logged out from the Central "
"Authentication Service. For security reasons, exit your web browser."
msgstr ""
"<h3>Logout successful</h3>You have successfully logged out from the Central "
"Authentication Service. For security reasons, exit your web browser."
#: views.py:134
#, python-format
msgid ""
"<h3>Logout successful</h3>You have successfully logged out from %s sessions "
"of the Central Authentication Service. For security reasons, exit your web "
"browser."
msgstr ""
"<h3>Logout successful</h3>You have successfully logged out from %s sessions "
"of the Central Authentication Service. For security reasons, exit your web "
"browser."
#: views.py:141
msgid ""
"<h3>Logout successful</h3>You were already logged out from the Central "
"Authentication Service. For security reasons, exit your web browser."
msgstr ""
"<h3>Logout successful</h3>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:3
26
#: views.py:3
59
#, python-format
msgid "Service %(url)s non allowed."
msgstr "Service %(url)s non allowed."
#: views.py:3
33
#: views.py:3
66
msgid "Username non allowed"
msgstr "Username non allowed"
#: views.py:3
40
#: views.py:3
73
msgid "User charateristics non allowed"
msgstr "User charateristics non allowed"
#: views.py:3
47
#: views.py:3
80
#, 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:4
17
#: views.py:4
50
#, python-format
msgid "Authentication renewal required by service %(name)s (%(url)s)."
msgstr "Authentication renewal required by service %(name)s (%(url)s)."
#: views.py:4
24
#: views.py:4
57
#, python-format
msgid "Authentication required by service %(name)s (%(url)s)."
msgstr "Authentication required by service %(name)s (%(url)s)."
#: views.py:4
31
#: views.py:4
64
#, python-format
msgid "Service %s non allowed"
msgstr "Service %s non allowed"
#~ msgid "Successfully logout"
#~ msgstr ""
#~ "<h3>Logout successful</h3>You have successfully logged out of the Central "
#~ "Authentication Service.</br>For security reasons, exit your web browser."
cas_server/locale/fr/LC_MESSAGES/django.mo
View file @
10c53a80
No preview for this file type
cas_server/locale/fr/LC_MESSAGES/django.po
View file @
10c53a80
...
...
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: cas_server\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-
17 19:2
1+0100\n"
"PO-Revision-Date: 2015-12-
17 19:22
+0100\n"
"POT-Creation-Date: 2015-12-
26 15:3
1+0100\n"
"PO-Revision-Date: 2015-12-
26 15:34
+0100\n"
"Last-Translator: Valentin Samir <valentin.samir@crans.org>\n"
"Language-Team: django <LL@li.org>\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 ""
"<h3>Déconnexion réussie</h3>\n"
"Vous vous êtes déconnecté(e) du Service Central d'Authentification.<br/>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 ""
"<h3>Logout successful</h3>You have successfully logged out from the Central "
"Authentication Service. For security reasons, exit your web browser."
msgstr ""
"<h3>Déconnexion réussie</h3>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 ""
"<h3>Logout successful</h3>You have successfully logged out from %s sessions "
"of the Central Authentication Service. For security reasons, exit your web "
"browser."
msgstr ""
"<h3>Déconnexion réussie</h3>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 ""
"<h3>Logout successful</h3>You were already logged out from the Central "
"Authentication Service. For security reasons, exit your web browser."
msgstr ""
"<h3>Déconnexion réussie</h3>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:3
26
#: views.py:3
59
#, python-format
msgid "Service %(url)s non allowed."
msgstr "le service %(url)s n'est pas autorisé."
#: views.py:3
33
#: views.py:3
66
msgid "Username non allowed"
msgstr "Nom d'utilisateur non authorisé"
#: views.py:3
40
#: views.py:3
73
msgid "User charateristics non allowed"
msgstr "Caractéristique utilisateur non autorisée"
#: views.py:3
47
#: views.py:3
80
#, 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:4
17
#: views.py:4
50
#, 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:4
24
#: views.py:4
57
#, python-format
msgid "Authentication required by service %(name)s (%(url)s)."
msgstr "Authentification requise par le service %(name)s (%(url)s)."
#: views.py:4
31
#: views.py:4
64
#, python-format
msgid "Service %s non allowed"
msgstr "Le service %s n'est pas autorisé"
#~ msgid "Successfully logout"
#~ msgstr ""
#~ "<h3>Déconnexion réussie</h3>\n"
#~ "Vous vous êtes déconnecté(e) du Service Central d'Authentification.<br/"
#~ ">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"
...
...
cas_server/templates/cas_server/logout.html
View file @
10c53a80
...
...
@@ -3,6 +3,6 @@
{% load staticfiles %}
{% load i18n %}
{% block content %}
<div
class=
"alert alert-success"
role=
"alert"
>
{
% trans "Successfully logout" %
}
</div>
<div
class=
"alert alert-success"
role=
"alert"
>
{
{logout_msg|safe}
}
</div>
{% endblock %}
cas_server/views.py
View file @
10c53a80
...
...
@@ -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"
))
se
ssion_nb
=
se
lf
.
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
=
_
(
"<h3>Logout successful</h3>"
"You have successfully logged out from the Central Authentication Service. "
"For security reasons, exit your web browser."
)
elif
session_nb
>
1
:
logout_msg
=
_
(
"<h3>Logout successful</h3>"
"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
=
_
(
"<h3>Logout successful</h3>"
"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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment