Forgot Password
confirm_new_password(request)
async
Confirm a password reset with the provided code and new password.
Validates the reset code and its expiry, ensures password confirmation matches, updates the user's password, and invalidates the code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
ForgotPasswordConfirmation
|
Confirmation payload with code and new password. |
required |
Returns:
| Type | Description |
|---|---|
|
Dict[str, str]: Confirmation message. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
404 if code is invalid or expired, or user not found. |
HTTPException
|
400 if passwords do not match. |
Source code in routers/forgot_password.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
send_forgot_password_code(request)
async
Send a password reset code to the user's email.
Generates a one-time code, stores it with an expiry, and emails a reset link.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
ForgotPasswordRequest
|
Request containing the user's email. |
required |
Returns:
| Type | Description |
|---|---|
|
Dict[str, str]: Confirmation message. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
404 if user not found. |
Source code in routers/forgot_password.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |