Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
VIPS
VIPSWeb
Commits
e13e5834
Commit
e13e5834
authored
9 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Removed debug output
parent
3dbb1204
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
security/middleware/check_login_middleware.py
+3
-1
3 additions, 1 deletion
security/middleware/check_login_middleware.py
with
3 additions
and
1 deletion
security/middleware/check_login_middleware.py
+
3
−
1
View file @
e13e5834
...
@@ -48,8 +48,9 @@ class CheckLoginMiddleware(object):
...
@@ -48,8 +48,9 @@ class CheckLoginMiddleware(object):
# 1. Is last_modified not present or more than 24 hours ago?
# 1. Is last_modified not present or more than 24 hours ago?
# If so: check with VIPSLogic if user_uuid is valid
# If so: check with VIPSLogic if user_uuid is valid
last_modified
=
request
.
session
.
get
(
"
last_modified
"
,
None
)
last_modified
=
request
.
session
.
get
(
"
last_modified
"
,
None
)
print
last_modified
#
print last_modified
age_limit
=
timedelta
(
days
=
1
)
age_limit
=
timedelta
(
days
=
1
)
#age_limit = timedelta(seconds = 10)
if
last_modified
==
None
or
datetime
.
strptime
(
last_modified
,
CheckLoginMiddleware
.
datetime_format
)
<
datetime
.
now
()
-
age_limit
:
if
last_modified
==
None
or
datetime
.
strptime
(
last_modified
,
CheckLoginMiddleware
.
datetime_format
)
<
datetime
.
now
()
-
age_limit
:
# 2. If not, check if UUID is present
# 2. If not, check if UUID is present
# If UUID present, try to login to VIPSLogic with it
# If UUID present, try to login to VIPSLogic with it
...
@@ -57,6 +58,7 @@ class CheckLoginMiddleware(object):
...
@@ -57,6 +58,7 @@ class CheckLoginMiddleware(object):
if
user_uuid
!=
None
:
if
user_uuid
!=
None
:
found_user
=
VipsLogicUser
.
find_by_uuid
(
user_uuid
)
found_user
=
VipsLogicUser
.
find_by_uuid
(
user_uuid
)
if
found_user
!=
None
:
if
found_user
!=
None
:
print
"
Found user. Logging in.
"
request
.
session
[
"
vips_logic_user
"
]
=
found_user
request
.
session
[
"
vips_logic_user
"
]
=
found_user
request
.
session
[
"
user_uuid
"
]
=
user_uuid
request
.
session
[
"
user_uuid
"
]
=
user_uuid
request
.
session
[
"
last_modified
"
]
=
datetime
.
now
().
strftime
(
CheckLoginMiddleware
.
datetime_format
)
request
.
session
[
"
last_modified
"
]
=
datetime
.
now
().
strftime
(
CheckLoginMiddleware
.
datetime_format
)
...
...
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