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
5d800fa6
Commit
5d800fa6
authored
Jul 05, 2018
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改coco端登录限制次数逻辑
parent
bd14266a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
api.py
apps/users/api.py
+3
-4
No files found.
apps/users/api.py
View file @
5d800fa6
...
@@ -199,17 +199,16 @@ class UserAuthApi(APIView):
...
@@ -199,17 +199,16 @@ class UserAuthApi(APIView):
key_prefix_limit
=
"_LOGIN_LIMIT_{}_{}"
key_prefix_limit
=
"_LOGIN_LIMIT_{}_{}"
def
post
(
self
,
request
):
def
post
(
self
,
request
):
user
,
msg
=
self
.
check_user_valid
(
request
)
# limit login
username
=
request
.
data
.
get
(
'username'
)
username
=
request
.
data
.
get
(
'username'
)
ip
=
request
.
data
.
get
(
'remote_addr'
,
None
)
ip
=
request
.
data
.
get
(
'remote_addr'
,
None
)
if
not
ip
:
ip
=
ip
if
ip
else
get_login_ip
(
request
)
ip
=
get_login_ip
(
request
)
key_limit
=
self
.
key_prefix_limit
.
format
(
ip
,
username
)
key_limit
=
self
.
key_prefix_limit
.
format
(
ip
,
username
)
if
is_block_login
(
key_limit
):
if
is_block_login
(
key_limit
):
msg
=
_
(
"Log in frequently and try again later"
)
msg
=
_
(
"Log in frequently and try again later"
)
return
Response
({
'msg'
:
msg
},
status
=
401
)
return
Response
({
'msg'
:
msg
},
status
=
401
)
user
,
msg
=
self
.
check_user_valid
(
request
)
if
not
user
:
if
not
user
:
data
=
{
data
=
{
'username'
:
request
.
data
.
get
(
'username'
,
''
),
'username'
:
request
.
data
.
get
(
'username'
,
''
),
...
...
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