reset password with custom UI
# support-questions
j
hello! Question about sending custom emails and updating the password from the frontend. I can override the
emailDelivery
on the backend, from the input I can get the
passwordResetLink
and from there I can extract the
token
from the URL params.
Copy code
{
   type: 'PASSWORD_RESET',
   user: {
     email: 'abc@gmail.com',
     id: '83cb2c80-c119-4bbe-b191-4c1ab67a950c',
     timeJoined: 1684502523294
   },
   passwordResetLink: 'http://localhost:3000/auth/reset-password?token=MTBjNzQwYThkZDdhZjk0YTUyODEzMGQ1YzZhM2NlY2E5ODkxNzQxNTM5M2M1ZmI0OGQ1OWJkMTIwYzBkODU5NjEzOWFiNzkxMjMyYjk3OTg0ZmMxYzZiMDY3MzQ5ODli&rid=emailpassword',
   userContext: { _default: { request: [FastifyRequest] } }
}
Now from the frontend, after I get the token from the URL, and after the user provides the new password, I should use the
submitNewPassword
function to send the new password along with the token yes? But on the frontend I see that the types do not match what I see in the documentation. I know this document might be old, so I'm wondering if there's a new way of doing it, maybe including the token in the
FormFields
array?

https://cdn.discordapp.com/attachments/644849840475602944/1109112640476815480/image.png

https://cdn.discordapp.com/attachments/644849840475602944/1109112640803983380/image.png

r
hey @Justine
you need to use it this way:
Copy code
let response = await submitNewPassword({
            formFields: [{
                id: "password",
                value: newPassword
            }]
        });
this is what's in the doc. So the doc is correct

https://cdn.discordapp.com/attachments/1109112641059823626/1109131693354401872/Screenshot_2023-05-19_at_20.23.13.png

j
thank you! Let me try it out 😃
ahh ok, so the
submitNewPassword
function will automatically take the
token
from the URL param and pass to the API for verification and updating the password?
r
Yes
j
thank you!