From e2466a6e4cda8ade7d755beae2d74e13454e91fa Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 23 Mar 2021 19:44:43 +0100 Subject: auth_required decorator --- api/user/status.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'api/user/status.py') diff --git a/api/user/status.py b/api/user/status.py index e2895d5..030a4ef 100644 --- a/api/user/status.py +++ b/api/user/status.py @@ -1,21 +1,15 @@ from flask import Blueprint, request from db import cursor, connection -from auth.login_token import token_login +from hierarchy import auth_required import json status = Blueprint('user_status', __name__) @status.route('/status', methods = ['POST']) +@auth_required("user") def index(): data = request.get_json() - status = data.get("status") or "" - token = request.cookies.get("token") or "" - - if not token: return "", 401 - login = token_login(token) or "" - - if not login: return "", 403 if not status: return "", 400 cursor.execute("update users set status = ? where user_id = ?", [status[0:200], login]) -- cgit v1.2.3