User creation should now be x-www-form-urlencoded

This commit is contained in:
Profitroll 2023-01-10 15:24:36 +01:00
parent c693756a43
commit 225c80f2f9

View File

@ -50,7 +50,7 @@ if configGet("registration_requires_confirmation") is True:
if configGet("registration_enabled") is True: if configGet("registration_enabled") is True:
@app.post("/users") @app.post("/users")
async def user_create(user: str, email: str, password: str): async def user_create(user: str = Form(), email: str = Form(), password: str = Form()):
if col_users.find_one( {"user": user} ) is not None: if col_users.find_one( {"user": user} ) is not None:
return HTTPException(HTTP_406_NOT_ACCEPTABLE, detail=configGet("user_already_exists", "messages")) return HTTPException(HTTP_406_NOT_ACCEPTABLE, detail=configGet("user_already_exists", "messages"))
col_users.insert_one( {"user": user, "email": email, "hash": get_password_hash(password), "disabled": configGet("registration_requires_confirmation")} ) col_users.insert_one( {"user": user, "email": email, "hash": get_password_hash(password), "disabled": configGet("registration_requires_confirmation")} )