[System] Fixed issue when Authorization header is missing
This commit is contained in:
parent
32783041d8
commit
ff6c973eef
|
@ -20,7 +20,11 @@ def login_required(permission=None):
|
|||
def wrap(func):
|
||||
@wraps(func)
|
||||
def wrapped_f(*args, **kwargs):
|
||||
token = list(filter(None, request.headers.get("Authorization").split(" ")))[-1]
|
||||
try:
|
||||
token = list(filter(None, request.headers.get("Authorization").split(" ")))[-1]
|
||||
except AttributeError:
|
||||
raise Unauthorized
|
||||
|
||||
session = sessionController.validate_token(token, request.user_agent, permission)
|
||||
if session:
|
||||
kwargs["current_session"] = session
|
||||
|
|
Loading…
Reference in New Issue