27 lines
708 B
Python
27 lines
708 B
Python
from fastapi import APIRouter, HTTPException
|
|
|
|
users = [] # In-memory storage
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/reset-password")
|
|
async def reset_password_demo(
|
|
email: str = "user@example.com",
|
|
new_password: str = "newpassword123"
|
|
):
|
|
"""Demo reset password endpoint"""
|
|
user = next((u for u in users if u["email"] == email), None)
|
|
if not user:
|
|
raise HTTPException(status_code=400, detail="Email not found")
|
|
|
|
user["password"] = new_password
|
|
|
|
return {
|
|
"message": "Password reset successful",
|
|
"user_id": user["id"],
|
|
"email": email,
|
|
"next_steps": [
|
|
"Login with new password",
|
|
"Review security settings"
|
|
]
|
|
} |