Gregniuki commited on
Commit
be9fa10
·
1 Parent(s): 9768922

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -10
main.py CHANGED
@@ -268,16 +268,9 @@ async def password_reset_request(email: str = Form(...), db: Session = Depends(g
268
  user = get_user_by_email(db, email)
269
 
270
 
271
- if not user:
272
- raise HTTPException(status_code=404, detail="User not found")
273
-
274
- # Generate a verification token
275
- verification_token = generate_verification_token(email)
276
-
277
- # Send a verification email with a password reset link
278
- reset_link = f"https://gregniuki-loginauth.hf.space/reset-password?token={verification_token}"
279
- send_verification_email(email, reset_link)
280
-
281
  return {"message": "Password reset link sent if the email is registered with us."}
282
  @app.get("/password-reset-request", response_class=HTMLResponse)
283
  async def password_reset_form(request: Request):
 
268
  user = get_user_by_email(db, email)
269
 
270
 
271
+ if user:
272
+ resetpassword(user,db)
273
+ # Always return the same message to avoid revealing whether an email is registered
 
 
 
 
 
 
 
274
  return {"message": "Password reset link sent if the email is registered with us."}
275
  @app.get("/password-reset-request", response_class=HTMLResponse)
276
  async def password_reset_form(request: Request):