DEV Community

Discussion on: How to Handle Password Reset in ExpressJS

Collapse
 
kelvinvmwinuka profile image
Kelvin Mwinuka

Hi Mete,

Good eye. If we don't check it here, the user update will throw an error. To avoid this we can add a guard clause to check the password reset object:

if (!passwordReset) {
    return res.status(404).send()
}

// Continue with the reset
Enter fullscreen mode Exit fullscreen mode