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
310bc6ad
Commit
310bc6ad
authored
Sep 13, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修复获取token的bug
parent
b54afbe7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
auth.py
apps/users/api/auth.py
+7
-5
No files found.
apps/users/api/auth.py
View file @
310bc6ad
...
...
@@ -12,19 +12,21 @@ from rest_framework.response import Response
from
rest_framework.views
import
APIView
from
common.utils
import
get_logger
,
get_request_ip
from
common.permissions
import
IsOrgAdminOrAppUser
from
orgs.mixins
import
RootOrgViewMixin
from
..serializers
import
UserSerializer
from
..tasks
import
write_login_log_async
from
..models
import
User
,
LoginLog
from
..utils
import
check_user_valid
,
generate_token
,
\
check_otp_code
,
increase_login_failed_count
,
is_block_login
,
clean_failed_count
from
common.permissions
import
IsOrgAdminOrAppUser
check_otp_code
,
increase_login_failed_count
,
is_block_login
,
\
clean_failed_count
from
..hands
import
Asset
,
SystemUser
logger
=
get_logger
(
__name__
)
class
UserAuthApi
(
APIView
):
class
UserAuthApi
(
RootOrgViewMixin
,
APIView
):
permission_classes
=
(
AllowAny
,)
serializer_class
=
UserSerializer
...
...
@@ -112,7 +114,7 @@ class UserAuthApi(APIView):
write_login_log_async
.
delay
(
**
data
)
class
UserConnectionTokenApi
(
APIView
):
class
UserConnectionTokenApi
(
RootOrgViewMixin
,
APIView
):
permission_classes
=
(
IsOrgAdminOrAppUser
,)
def
post
(
self
,
request
):
...
...
@@ -176,7 +178,7 @@ class UserToken(APIView):
return
Response
({
'error'
:
msg
},
status
=
406
)
class
UserOtpAuthApi
(
APIView
):
class
UserOtpAuthApi
(
RootOrgViewMixin
,
APIView
):
permission_classes
=
(
AllowAny
,)
serializer_class
=
UserSerializer
...
...
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