Connected set new password to backend
This commit is contained in:
1 parent
d1427010c2
commit
a8af106606
5 files changed
+105
-19
No files matched your search
@@ -167,7 +167,7 @@ const recoveryRequestController = async (req, res, next) => {
|
||||
await sendEmail(
|
||||
[req.body.email],
|
||||
"Uptime Monitor Password Recovery",
|
||||
`<a href='${process.env.CLIENT_HOST}/set-new-password/${recoveryToken.token}'>Click here to reset your password</a>`,
|
||||
`<a clicktracking="off" href='${process.env.CLIENT_HOST}/set-new-password/${recoveryToken.token}'>Click here to reset your password</a>`,
|
||||
`Recovery token: ${recoveryToken.token}`
|
||||
);
|
||||
return res.status(200).json({
|
||||
|
||||
@@ -131,7 +131,6 @@ const validateRecoveryToken = async (req, res) => {
|
||||
const resetPassword = async (req, res) => {
|
||||
try {
|
||||
const newPassword = req.body.password;
|
||||
|
||||
// Validate token again
|
||||
const recoveryToken = await validateRecoveryToken(req, res);
|
||||
const user = await UserModel.findOne({ email: recoveryToken.email });
|
||||
@@ -148,7 +147,9 @@ const resetPassword = async (req, res) => {
|
||||
} else {
|
||||
throw new Error("User not found");
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
//****************************************
|
||||
|
||||
Reference in new issue
Block a user