Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
42ff5a38
Commit
42ff5a38
authored
Aug 08, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改设置session的时间,避免sdk等报错
parent
0ee5d3b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
middleware.py
apps/jumpserver/middleware.py
+2
-1
user.py
apps/users/api/user.py
+5
-0
No files found.
apps/jumpserver/middleware.py
View file @
42ff5a38
...
@@ -57,7 +57,8 @@ class RequestMiddleware:
...
@@ -57,7 +57,8 @@ class RequestMiddleware:
def
__call__
(
self
,
request
):
def
__call__
(
self
,
request
):
set_current_request
(
request
)
set_current_request
(
request
)
response
=
self
.
get_response
(
request
)
response
=
self
.
get_response
(
request
)
if
not
settings
.
SESSION_EXPIRE_AT_BROWSER_CLOSE
:
is_request_api
=
request
.
path
.
startswith
(
'/api'
)
if
not
settings
.
SESSION_EXPIRE_AT_BROWSER_CLOSE
and
not
is_request_api
:
age
=
request
.
session
.
get_expiry_age
()
age
=
request
.
session
.
get_expiry_age
()
request
.
session
.
set_expiry
(
age
)
request
.
session
.
set_expiry
(
age
)
return
response
return
response
apps/users/api/user.py
View file @
42ff5a38
...
@@ -179,6 +179,11 @@ class UserProfileApi(generics.RetrieveAPIView):
...
@@ -179,6 +179,11 @@ class UserProfileApi(generics.RetrieveAPIView):
def
get_object
(
self
):
def
get_object
(
self
):
return
self
.
request
.
user
return
self
.
request
.
user
def
retrieve
(
self
,
request
,
*
args
,
**
kwargs
):
age
=
request
.
session
.
get_expiry_age
()
request
.
session
.
set_expiry
(
age
)
return
super
()
.
retrieve
(
request
,
*
args
,
**
kwargs
)
class
UserResetOTPApi
(
generics
.
RetrieveAPIView
):
class
UserResetOTPApi
(
generics
.
RetrieveAPIView
):
queryset
=
User
.
objects
.
all
()
queryset
=
User
.
objects
.
all
()
...
...
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