This commit is contained in:
Michał Gdula 2023-04-21 17:49:08 +00:00
parent e69ac64855
commit e3c25a5241
3 changed files with 3 additions and 6 deletions

View file

@ -1,7 +1,6 @@
"""
Onlylegs - API endpoints
"""
from uuid import uuid4
import os
import pathlib
import re
@ -31,7 +30,7 @@ def account_picture(user_id):
# If no image is uploaded, return 404 error
if not file:
return jsonify({"error": "No file uploaded"}), 400
elif user.id != current_user.id:
if user.id != current_user.id:
return jsonify({"error": "You are not allowed to do this, go away"}), 403
# Get file extension, generate random name and set file path
@ -84,7 +83,7 @@ def account_username(user_id):
# Validate the form
if not new_name or not username_regex.match(new_name):
return jsonify({"error": "Username is invalid"}), 400
elif user.id != current_user.id:
if user.id != current_user.id:
return jsonify({"error": "You are not allowed to do this, go away"}), 403
# Save to database

View file

@ -2,7 +2,6 @@
Onlylegs - API endpoints
Media upload and retrieval
"""
import os
from uuid import uuid4
import os
import pathlib