Skip to content

Commit

Permalink
User friendly error whenset pasword link is expired
Browse files Browse the repository at this point in the history
Ref #42
  • Loading branch information
ir4y committed Nov 18, 2024
1 parent e641e64 commit 6a89e6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ template: |-
<br />
Please click on the link below to reset your password: <a href="{{confirm-href}}">{{ confirm-href }}</a> <br />
<br />
The link is valid for 24 hours.<br />
If you did not request a password reset, please do not click the link to reset your password.
If you have received this message in error, or if you have any questions or concerns,
please contact us at Dexter.Hadley@ucf.edu <br />
Expand Down
4 changes: 2 additions & 2 deletions ucf-app/app/auth/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ async def set_password_op(operation, request):
await client.resources("SetPasswordToken").search(_id=set_password_token_id).first()
)
if not is_set_password_token_valid(set_password_token):
raise OperationOutcome(reason="Invalid request")
raise OperationOutcome(reason="The reset password link is expired, please request a new one")
user = await set_password_token["user"].to_resource()

await user.patch(**{"password": password})
await set_password_token.patch(**{"status": "used"})
await remove_user_sessions(db, user.id)

return web.json_response({"message": "The password was successfully changed"})
return web.json_response({"message": "The password was successfully changed"})

0 comments on commit 6a89e6e

Please sign in to comment.