From 906674fcdb44a583d3b75d89b100a8e431e11020 Mon Sep 17 00:00:00 2001 From: profitroll Date: Mon, 9 Jan 2023 15:22:51 +0100 Subject: [PATCH] user_delete accepts x-www-form-urlencoded now --- extensions/users.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/users.py b/extensions/users.py index ed3c05b..393be62 100644 --- a/extensions/users.py +++ b/extensions/users.py @@ -6,7 +6,7 @@ from modules.scheduler import scheduler from modules.mailer import mail_sender from uuid import uuid1 -from fastapi import Depends, HTTPException +from fastapi import Depends, HTTPException, Form from fastapi.responses import Response, UJSONResponse from starlette.status import HTTP_204_NO_CONTENT, HTTP_400_BAD_REQUEST, HTTP_406_NOT_ACCEPTABLE @@ -60,7 +60,7 @@ if configGet("registration_enabled") is True: @app.delete("/users/me/") -async def user_delete(password: str, current_user: User = Depends(get_current_active_user)): +async def user_delete(password: str = Form(), current_user: User = Depends(get_current_active_user)): user = get_user(current_user.user) if not user: return False @@ -70,4 +70,5 @@ async def user_delete(password: str, current_user: User = Depends(get_current_ac col_emails.delete_many( {"user": current_user.user} ) col_photos.delete_many( {"user": current_user.user} ) col_videos.delete_many( {"user": current_user.user} ) - col_albums.delete_many( {"user": current_user.user} ) \ No newline at end of file + col_albums.delete_many( {"user": current_user.user} ) + return Response(status_code=HTTP_204_NO_CONTENT) \ No newline at end of file