Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
269e1b6c
authored
Aug 31, 2016
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: superuser accounts with shorter sessions
parent
7cef5bd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
circle/dashboard/views/user.py
+12
-0
No files found.
circle/dashboard/views/user.py
View file @
269e1b6c
...
@@ -63,6 +63,14 @@ from .util import saml_available, DeleteViewBase, LoginView
...
@@ -63,6 +63,14 @@ from .util import saml_available, DeleteViewBase, LoginView
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
def
set_session_expiry
(
request
,
user
):
if
user
.
is_superuser
:
messages
.
info
(
request
,
_
(
"You've logged in with an administrator "
"account, your session will expire when "
"the web browser is closed."
))
request
.
session
.
set_expiry
(
0
)
class
NotificationView
(
LoginRequiredMixin
,
TemplateView
):
class
NotificationView
(
LoginRequiredMixin
,
TemplateView
):
def
get_template_names
(
self
):
def
get_template_names
(
self
):
...
@@ -119,6 +127,7 @@ class CircleLoginView(LoginView):
...
@@ -119,6 +127,7 @@ class CircleLoginView(LoginView):
else
:
else
:
response
=
super
(
CircleLoginView
,
self
)
.
form_valid
(
form
)
response
=
super
(
CircleLoginView
,
self
)
.
form_valid
(
form
)
set_language_cookie
(
self
.
request
,
response
)
set_language_cookie
(
self
.
request
,
response
)
set_session_expiry
(
self
.
request
,
user
)
return
response
return
response
...
@@ -646,6 +655,8 @@ class TwoFactorLoginView(FormView):
...
@@ -646,6 +655,8 @@ class TwoFactorLoginView(FormView):
login
(
self
.
request
,
user
)
login
(
self
.
request
,
user
)
response
=
redirect
(
self
.
request
.
session
[
'two-fa-redirect'
])
response
=
redirect
(
self
.
request
.
session
[
'two-fa-redirect'
])
set_language_cookie
(
self
.
request
,
response
)
set_language_cookie
(
self
.
request
,
response
)
set_session_expiry
(
self
.
request
,
user
)
return
response
return
response
...
@@ -732,6 +743,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
...
@@ -732,6 +743,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
return
redirect
(
reverse
(
"two-factor-login"
))
return
redirect
(
reverse
(
"two-factor-login"
))
else
:
else
:
login
(
request
,
user
)
login
(
request
,
user
)
set_session_expiry
(
request
,
user
)
def
_set_subject_id
(
session
,
subject_id
):
def
_set_subject_id
(
session
,
subject_id
):
session
[
'_saml2_subject_id'
]
=
code
(
subject_id
)
session
[
'_saml2_subject_id'
]
=
code
(
subject_id
)
...
...
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