Skip to content

Commit 125d898

Browse files
committed
fix: check admin api to use jwt tokens
1 parent abfe86d commit 125d898

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backend/user.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from app import swagger
88
from flasgger.utils import swag_from
99
from auth import forgot_password
10+
from flask_jwt_extended import jwt_required, get_jwt_identity
1011

1112
load_dotenv()
1213

@@ -194,8 +195,10 @@ def account():
194195

195196
@app.route("/users/admin", methods=["POST"])
196197
@swag_from("documentation/check_admin_user.yaml", methods=["POST"])
198+
@jwt_required()
197199
def admin():
198-
uuid = request.form.get("uuid")
200+
uuid = get_jwt_identity()
201+
199202
if not uuid:
200203
return jsonify({"message": "Unauthorized", "code": 401}), 401
201204
else:

0 commit comments

Comments
 (0)