user_delete accepts x-www-form-urlencoded now

This commit is contained in:
Profitroll 2023-01-09 15:22:51 +01:00
parent 19b1ae6158
commit 906674fcdb

View File

@ -6,7 +6,7 @@ from modules.scheduler import scheduler
from modules.mailer import mail_sender from modules.mailer import mail_sender
from uuid import uuid1 from uuid import uuid1
from fastapi import Depends, HTTPException from fastapi import Depends, HTTPException, Form
from fastapi.responses import Response, UJSONResponse from fastapi.responses import Response, UJSONResponse
from starlette.status import HTTP_204_NO_CONTENT, HTTP_400_BAD_REQUEST, HTTP_406_NOT_ACCEPTABLE 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/") @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) user = get_user(current_user.user)
if not user: if not user:
return False 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_emails.delete_many( {"user": current_user.user} )
col_photos.delete_many( {"user": current_user.user} ) col_photos.delete_many( {"user": current_user.user} )
col_videos.delete_many( {"user": current_user.user} ) col_videos.delete_many( {"user": current_user.user} )
col_albums.delete_many( {"user": current_user.user} ) col_albums.delete_many( {"user": current_user.user} )
return Response(status_code=HTTP_204_NO_CONTENT)