Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
compendium-v2
Commits
d09f9dc8
Commit
d09f9dc8
authored
1 year ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Make session length 7 days instead of default of 31
parent
2faabf52
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compendium_v2/routes/authentication.py
+10
-4
10 additions, 4 deletions
compendium_v2/routes/authentication.py
with
10 additions
and
4 deletions
compendium_v2/routes/authentication.py
+
10
−
4
View file @
d09f9dc8
from
flask
_login
import
login_required
,
login_user
,
logout_user
# type: ignore
from
flask
import
Blueprint
,
url_for
,
redirect
from
flask_login
import
login_user
,
logout_user
# type: ignore
from
flask
import
Blueprint
,
url_for
,
redirect
,
session
,
current_app
from
datetime
import
timedelta
from
compendium_v2.auth
import
get_client
from
compendium_v2.auth.session_management
import
fetch_user
,
create_user
routes
=
Blueprint
(
'
authentication
'
,
__name__
)
@routes.before_request
def
before_request
():
# logout users if they haven't visited in 7 days (session refreshes on each visit)
session
.
permanent
=
True
current_app
.
permanent_session_lifetime
=
timedelta
(
days
=
7
)
@routes.route
(
'
/login
'
)
def
login
():
client
=
get_client
()
...
...
@@ -37,7 +44,6 @@ def authorize():
@routes.route
(
"
/logout
"
)
@login_required
def
logout
():
# The user will be logged out of the application, but not the IDP.
# If they visit again before their oauth token expires, they are immediately logged in.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment