def inner(request, *args, **kwargs): token_string = extract_token_from_request(request) cookie_string = extract_cookie_from_request(request) user = None if token_string: user = token.verify_token(token_string) return func(request, user, cookie_string, *args, **kwargs)
def inner(request, *args, **kwargs): token_string = extract_token_from_request(request) if token_string is None: return code_response(codes.BAD_REQUEST) user = token.verify_token(token_string) if user is None: return code_response(codes.TOKEN_INVALID) return func(request, user, *args, **kwargs)
def inner(request, *args, **kwargs): token_string = extract_token_from_request(request) cookie_string = extract_cookie_from_request(request) if token_string is None and cookie_string is None: return code_response( codes.BAD_REQUEST, messages.MISSING_REQUIRED_PARAMS.format("token or cookie")) user = None if token_string: user = token.verify_token(token_string) return func(request, user, cookie_string, *args, **kwargs)