Forget Password

The forgot password flow allows users to securely reset their password if they cannot log in. Users enter their registered email address to initiate the process, and an email with a time-sensitive reset link is sent to them.

Clicking the link directs the user to a secure form where they can set a new password. This flow ensures security by verifying the user’s identity through email and expiring the link after a short duration to prevent unauthorized access.

You can see the implementation below

https://github.com/madewithnovel/novel/blob/main/app/features/lifecycle/forgot.ts

https://github.com/madewithnovel/novel/blob/main/app/api/internal/v1/auth-forgot/index.ts

https://github.com/madewithnovel/novel/blob/main/app/api/internal/v1/auth-reset/index.ts

API

Reset Password

post

Final step in resetting a user's password.

Body
emailstring · emailRequired
passwordstringRequired
tokenstringRequired
Responses
201
Reset successful. Redirecting to next step...
application/json
post
POST /auth/reset HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 59

{
  "email": "[email protected]",
  "password": "text",
  "token": "text"
}
201

Reset successful. Redirecting to next step...

{
  "redirect_to": "text"
}

Start Reset Password

post

Start a reset password attempt.

Body
emailstring · emailOptional
Responses
204
Forget password attempt created.
application/json
Responseany

Forget password attempt created.

post
POST /auth/forgot HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 26

{
  "email": "[email protected]"
}
204

Forget password attempt created.

No content

Changelog

  • 2024-12-20 - Initial Documentation

Last updated

Was this helpful?