DEV Community


Discussion on: How to Handle Password Reset in ExpressJS

kelvinvmwinuka profile image
Kelvin Mwinuka Author

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