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
ea3f8af1
Commit
ea3f8af1
authored
8 years ago
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pubkey auth bug
parent
a75e1db9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
api.py
apps/users/api.py
+1
-1
utils.py
apps/users/utils.py
+8
-2
No files found.
apps/users/api.py
View file @
ea3f8af1
...
...
@@ -140,4 +140,4 @@ class UserTokenApi(APIView):
cache
.
set
(
'
%
s_
%
s'
%
(
user
.
id
,
remote_addr
),
token
,
self
.
expiration
)
return
Response
({
'token'
:
token
,
'id'
:
user
.
id
,
'username'
:
user
.
username
,
'name'
:
user
.
name
})
else
:
return
Response
({
'msg'
:
'Invalid password or public key or user is not active or expired'
})
return
Response
({
'msg'
:
'Invalid password or public key or user is not active or expired'
}
,
status
=
401
)
This diff is collapsed.
Click to expand it.
apps/users/utils.py
View file @
ea3f8af1
...
...
@@ -187,8 +187,14 @@ def check_user_valid(**kwargs):
return
None
if
password
and
user
.
check_password
(
password
):
return
user
if
public_key
and
user
.
public_key
==
public_key
:
return
user
if
public_key
:
public_key_saved
=
user
.
public_key
.
split
()
if
len
(
public_key_saved
)
==
1
:
if
public_key
==
public_key_saved
[
0
]:
return
user
elif
len
(
public_key_saved
)
>
1
:
if
public_key
==
public_key_saved
[
1
]:
return
user
return
None
...
...
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