update main.py

kaasislekker
This commit is contained in:
ben
2026-08-18 17:17:58 +02:00
parent d4be4933f8
commit 4fac3f91b6
2 changed files with 91 additions and 1 deletions
+26
View File
@@ -30,6 +30,7 @@ from auth import (
change_password,
delete_me,
reset_password,
reset_password_with_token,
)
from permissions import (
@@ -126,6 +127,10 @@ class RoomCreate(BaseModel):
class ForgotPassword(BaseModel):
email: EmailStr
class PasswordReset(BaseModel):
token: str
new_password: str = Field(min_length=8)
class RoomSearch(BaseModel):
invite_code: str
@@ -1134,6 +1139,27 @@ def api_forgot_password(
):
return reset_password(data.email)
@app.post(
"/update-password",
summary="Reset password with token",
description="Sets a new password using a password reset token.",
)
def api_update_password(
data: PasswordReset,
):
result = reset_password_with_token(
data.token,
data.new_password,
)
if result["status"] == "failed":
raise HTTPException(
status_code=400,
detail=result["reason"],
)
return result
# easter egg
@app.get(