diff --git a/consumerWebsite/database/mySQL.js b/consumerWebsite/database/mySQL.js index 275674f..942907a 100644 --- a/consumerWebsite/database/mySQL.js +++ b/consumerWebsite/database/mySQL.js @@ -21,7 +21,6 @@ const sequelize = new Sequelize( }, }, - ); sequelize.authenticate().then(() => { diff --git a/consumerWebsite/functions/nodeMail.js b/consumerWebsite/functions/nodeMail.js index c54f8b7..6ca7d2a 100644 --- a/consumerWebsite/functions/nodeMail.js +++ b/consumerWebsite/functions/nodeMail.js @@ -62,7 +62,6 @@ async function sendTokenEmail(email, token) {
EcoSaver Team
Please do not reply to this email.
- `, }); transporter.sendMail({ tokenMessage }, function (error, info) { @@ -77,19 +76,19 @@ async function sendTokenEmail(email, token) { } } -async function sendResetPasswordEmail(email, message) { - console.log(email, message); - +async function sendResetPasswordEmail(email, link, resetToken) { + console.log(email); try { let resetMessage = await transporter.sendMail({ - to: process.env.euser, + to: email, + from: process.env.euser, subject: "Reset Password", html: `Reset Password Link: ${link}
+One time token: ${resetToken}
From: Eco Saver
-User Email: ${email}
-Message: ${message}
-Kindly click on the link given to reset your password!
+Kindly click on the link and key in the one time token given to reset your password!
Regards,
EcoSaver Team
@@ -108,36 +107,4 @@ async function sendResetPasswordEmail(email, message) { } } -async function sendResetTokenEmail(email, token) { - - try { - let tokenMessage = await transporter.sendMail({ - to: email, - from: process.env.euser, - subject: "API Token", - html: ` -Token: ${token}
-Please do not lose this token and do not share your token with anyone!
-Thank you for using EcoSaver.
-Regards,
-EcoSaver Team
- -Please do not reply to this email.
- - `, - }); - transporter.sendMail({ resetMessage }, function (error, info) { - if (error) { - console.log(error); - } else { - console.log("Email sent: " + info.response); - } - }); - } catch (error) { - console.error(error); - } -} - - -module.exports = { sendContactEmail , sendTokenEmail, sendResetPasswordEmail, sendResetTokenEmail }; +module.exports = { sendContactEmail , sendTokenEmail, sendResetPasswordEmail }; diff --git a/consumerWebsite/routes/auth.js b/consumerWebsite/routes/auth.js index 675e72d..29b8c1c 100644 --- a/consumerWebsite/routes/auth.js +++ b/consumerWebsite/routes/auth.js @@ -84,7 +84,7 @@ router.post("/checkemail", async (req, res, next) => { } 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!", }); diff --git a/consumerWebsite/views/forgotPassword.ejs b/consumerWebsite/views/forgotPassword.ejs index 735c74e..47d4a1a 100644 --- a/consumerWebsite/views/forgotPassword.ejs +++ b/consumerWebsite/views/forgotPassword.ejs @@ -3,10 +3,10 @@
- ![]() Your password has been resetted- |
-
- Hello, -Please check your email to reset your password. - |
-