diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-01-15 13:48:57 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-01-15 13:48:57 +0100 |
commit | 1403e2cf7eddd4f8793c273452c6659d1e972d31 (patch) | |
tree | 4f91be887bfe30c7f2a41205135ca8c2ce05cfda /api | |
parent | fd4c608f2cf61a3bc655cda49a1e2d0884f2a8fa (diff) |
/user/info using token
Diffstat (limited to 'api')
-rw-r--r-- | api/user/info.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/api/user/info.py b/api/user/info.py index b63e2c9..ffa004e 100644 --- a/api/user/info.py +++ b/api/user/info.py @@ -1,5 +1,6 @@ from flask import Blueprint, request from main import cursor +from auth.login_token import token_login info = Blueprint('info', __name__) @@ -9,11 +10,15 @@ def index(): username = data.get("username") or "" id = data.get("id") or "" + token = request.cookies.get("token") or "" if not username and \ - not id: + not id and \ + not token: return "", 400 + if token: id = token_login(token)[0] + if username: user = cursor.execute("select username, user_id, country, type, registered, avatar from users where username = ?", [username]).fetchone() else: |