Update authorization for team (#3262)

### What problem does this PR solve?

Update authorization for team.
#3253 #3233
### Type of change

- [x] Refactoring

---------

Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn>
This commit is contained in:
liuhua
2024-11-07 19:26:03 +08:00
committed by GitHub
parent 96b5d2b3a9
commit 48ab6d7a45
5 changed files with 26 additions and 18 deletions

View File

@ -280,7 +280,10 @@ def construct_error_response(e):
def token_required(func):
@wraps(func)
def decorated_function(*args, **kwargs):
token = flask_request.headers.get('Authorization').split()[1]
authorization_list=flask_request.headers.get('Authorization').split()
if len(authorization_list) < 2:
return get_json_result(data=False,message="Please check your authorization format.")
token = authorization_list[1]
objs = APIToken.query(token=token)
if not objs:
return get_json_result(