diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-04-16 16:57:26 +0200 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-04-16 16:57:26 +0200 |
commit | 07c2b124e4348b15f1e5ec18c6cdfd77248c6bc8 (patch) | |
tree | e4a29123d3ebedc1d25500390c904c66b3b02489 /api/auth/login_token.py | |
parent | aa2c999702dadba2afbcf2be9f597f890aafcc87 (diff) |
spaces > tabs in python :(
Diffstat (limited to 'api/auth/login_token.py')
-rw-r--r-- | api/auth/login_token.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/api/auth/login_token.py b/api/auth/login_token.py index b5b1579..de770b3 100644 --- a/api/auth/login_token.py +++ b/api/auth/login_token.py @@ -5,12 +5,12 @@ from auth.token import validate_token, hash_token # get user_id from authentication token def token_login(token): - hashed = hash_token({"token": token, "expirationDate": 0}) - user_id = cursor.execute( - "select user_id from users where valid_tokens like ?", - [f"%{hashed['token']}%"] - ).fetchone() - return None if not user_id else user_id[0] + hashed = hash_token({"token": token, "expirationDate": 0}) + user_id = cursor.execute( + "select user_id from users where valid_tokens like ?", + [f"%{hashed['token']}%"] + ).fetchone() + return None if not user_id else user_id[0] token = Blueprint('token', __name__) @@ -19,12 +19,12 @@ token = Blueprint('token', __name__) # this endpoint is currently unused, but verifies that a token is valid @token.route('/token', methods=['POST']) def index(): - data = request.get_json() + data = request.get_json() - auth_token = data.get("token") or "" - if not auth_token: return "", 400 + auth_token = data.get("token") or "" + if not auth_token: return "", 400 - return "", 200 if token_login(auth_token) else 401 + return "", 200 if token_login(auth_token) else 401 dynamic_route = ["/auth", token] |