Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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
8 years ago
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: superuser accounts with shorter sessions
parent
7cef5bd6
Pipeline
#185
passed with stage
in 0 seconds
Changes
1
Pipelines
1
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
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
):
def
get_template_names
(
self
):
...
...
@@ -119,6 +127,7 @@ class CircleLoginView(LoginView):
else
:
response
=
super
(
CircleLoginView
,
self
)
.
form_valid
(
form
)
set_language_cookie
(
self
.
request
,
response
)
set_session_expiry
(
self
.
request
,
user
)
return
response
...
...
@@ -646,6 +655,8 @@ class TwoFactorLoginView(FormView):
login
(
self
.
request
,
user
)
response
=
redirect
(
self
.
request
.
session
[
'two-fa-redirect'
])
set_language_cookie
(
self
.
request
,
response
)
set_session_expiry
(
self
.
request
,
user
)
return
response
...
...
@@ -732,6 +743,7 @@ if hasattr(settings, 'SAML_ORG_ID_ATTRIBUTE'):
return
redirect
(
reverse
(
"two-factor-login"
))
else
:
login
(
request
,
user
)
set_session_expiry
(
request
,
user
)
def
_set_subject_id
(
session
,
subject_id
):
session
[
'_saml2_subject_id'
]
=
code
(
subject_id
)
...
...
This diff is collapsed.
Click to expand it.
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