WIP: Custom exceptions handling and new models
This commit is contained in:
@@ -50,7 +50,7 @@ if configGet("registration_requires_confirmation") is True:
|
||||
return UJSONResponse( {"detail": configGet("email_confirmed", "messages")} )
|
||||
|
||||
if configGet("registration_enabled") is True:
|
||||
@app.post("/users")
|
||||
@app.post("/users", status_code=HTTP_204_NO_CONTENT)
|
||||
async def user_create(user: str = Form(), email: str = Form(), password: str = Form()):
|
||||
if col_users.find_one( {"user": user} ) is not None:
|
||||
raise HTTPException(HTTP_406_NOT_ACCEPTABLE, detail=configGet("user_already_exists", "messages"))
|
||||
@@ -60,7 +60,7 @@ if configGet("registration_enabled") is True:
|
||||
return Response(status_code=HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
@app.delete("/users/me/")
|
||||
@app.delete("/users/me/", status_code=HTTP_204_NO_CONTENT)
|
||||
async def user_delete(password: str = Form(), current_user: User = Depends(get_current_active_user)):
|
||||
user = get_user(current_user.user)
|
||||
if not user:
|
||||
|
Reference in New Issue
Block a user