Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
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
chaonan
unify_api2
Commits
eb25c449
Commit
eb25c449
authored
Apr 04, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug_login_auth
parent
d3b3699e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
18 deletions
+31
-18
pot_libs
pot_libs
+1
-1
login_auth.py
unify_api/modules/common/procedures/login_auth.py
+30
-17
No files found.
pot_libs
@
a878a1f8
Subproject commit
05cfad9387871294a0215dabeccad37adbc487e3
Subproject commit
a878a1f82788f11deea04f8e64f668a83ed3a449
unify_api/modules/common/procedures/login_auth.py
View file @
eb25c449
...
...
@@ -21,7 +21,7 @@ def authorized():
# run some method that checks the request
# for the client's authorization status
is_authorized
=
await
user_product_auth
.
check_user_auth
(
request
)
if
is_authorized
:
# the user is authorized.
# run the handler method and return the response
...
...
@@ -30,9 +30,9 @@ def authorized():
else
:
# the user is not authorized.
return
json
({
'status'
:
'not_authorized'
},
403
)
return
decorated_function
return
decorator
...
...
@@ -42,62 +42,69 @@ async def get_test(request):
def
is_need_verify
(
path
):
# return False
if
SETTING
.
debug_mode
==
1
:
return
False
if
"swagger"
in
path
:
return
False
log
.
info
(
"is_or_not_need_verify path:
%
s"
,
path
)
if
"swagger"
in
path
:
return
False
if
re
.
match
(
"^/unify-api/auth/?$"
,
path
):
log
.
info
(
"auth not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/upgrade/?"
,
path
):
log
.
info
(
"upgrade device not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/uassistant/?"
,
path
):
log
.
info
(
"uassistant not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/device-cloud/?"
,
path
):
log
.
info
(
"device_cloud not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/users/current-user-info/send-sms?"
,
path
):
log
.
info
(
"send-sms not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/users/current-user-info/save-userinfo?"
,
path
):
log
.
info
(
"save-userinfo not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/users/current-user-info/auth-phone?"
,
path
):
log
.
info
(
"auth-phone not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/users/current-user-info/back-password?"
,
path
):
log
.
info
(
"back-password not need verify"
)
return
False
if
re
.
match
(
"^/unify-api/users/current-user-info/update-password?"
,
path
):
log
.
info
(
"update-password not need verify"
)
return
False
if
re
.
match
(
"^/api/common/wechat/mp"
,
path
):
log
.
info
(
"/api/common/wechat/mp not need verify"
)
return
False
if
re
.
search
(
"/qk-website"
,
path
):
log
.
info
(
f
"{path} not need verify"
)
return
False
# if re.match("^/unify-api/users/logout/user-logout/?$", path):
# log.info("logout not need verify")
# return False
return
True
async
def
auth_verify
(
request
):
if
SETTING
.
debug_mode
==
1
:
return
False
path
=
request
.
path
if
is_need_verify
(
path
):
token
=
request
.
token
...
...
@@ -136,6 +143,10 @@ async def auth_verify(request):
def
is_need_auth_verify_cid
(
path
):
if
SETTING
.
debug_mode
==
1
:
return
False
if
"swagger"
in
path
:
return
False
if
re
.
match
(
"^/unify-api/auth/"
,
path
):
return
False
if
re
.
match
(
"^/api/common/wechat/mp"
,
path
):
...
...
@@ -148,6 +159,8 @@ def is_need_auth_verify_cid(path):
async
def
auth_verify_cid
(
request
):
"""增加工厂权限校验"""
if
SETTING
.
debug_mode
==
1
:
return
False
path
=
request
.
path
# if not re.match("^/unify-api/auth/?$", path):
if
is_need_auth_verify_cid
(
path
):
...
...
@@ -191,7 +204,7 @@ async def auth_verify_cid(request):
# if cid_info:
# cid_res_list = [int(cid) for cid in cid_info.get("product")]
# else:
# cid_res_list = await get_cids(user_id, product)
# 2.3 参数中的cid_args
cid_args
=
None
...
...
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