This commit is contained in:
viviannTam
2024-01-30 14:48:17 +08:00
parent 9a5e128f3f
commit 31fe6b3c7c
11 changed files with 91 additions and 164 deletions

View File

@ -72,4 +72,28 @@ router.post("/contact", async (req, res, next) => {
}
});
//reset
router.post("/checkemail", async (req, res, next) => {
try{
//console.log(req.body);
let Res = await checkEmail(req.body.email);
if (!Res) {
let error = new Error("Email not found");
error.status = 400;
return next(error);
}
else{
//console.log(Res);
send(req.body.email, req.body.name, req.body.message);
return res.json({
message: "Reset Password Link has successfully sent to your email!",
});
}
}catch (error){
console.error(error);
next(error);
}
});
module.exports = router;

View File

@ -76,8 +76,4 @@ router.delete("/delete", async function (req, res, next) {
});
});
const {user_forgotPassword, user_resetPassword } = require('../controller/user_controller');
router.route("/forgotPassword").post(user_forgotPassword);
router.route("/resetPassword").post(user_resetPassword);
module.exports = router;