blob: e2895d5197c091172fa98f342b17d5917de7fa34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from flask import Blueprint, request
from db import cursor, connection
from auth.login_token import token_login
import json
status = Blueprint('user_status', __name__)
@status.route('/status', methods = ['POST'])
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])
connection.commit()
return "", 200
dynamic_route = ["/user", status]
|