c
This commit is contained in:
parent
31fe6b3c7c
commit
7bd92805dd
@ -21,7 +21,6 @@ const sequelize = new Sequelize(
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
);
|
||||
|
||||
sequelize.authenticate().then(() => {
|
||||
|
@ -62,7 +62,6 @@ async function sendTokenEmail(email, token) {
|
||||
<p>EcoSaver Team</p>
|
||||
<p><a href="https://ecosaver.teeseng.uk/">EcoSaver Website</a></p>
|
||||
<p>Please do not reply to this email.</p>
|
||||
|
||||
`,
|
||||
});
|
||||
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: `
|
||||
<h1>Reset Password</h1>
|
||||
<p><strong>Reset Password Link:</strong> ${link}</p>
|
||||
<p><strong>One time token:</strong> ${resetToken}</p>
|
||||
<p><strong>From:</strong> Eco Saver</p>
|
||||
<p><strong>User Email:</strong> ${email}</p>
|
||||
<p><strong>Message:</strong> ${message}</p>
|
||||
<p>Kindly click on the link given to reset your password!</p>
|
||||
<p>Kindly click on the link and key in the one time token given to reset your password!</p>
|
||||
<p>Regards,</p>
|
||||
<p>EcoSaver Team</p>
|
||||
<p><a href="https://ecosaver.teeseng.uk/">EcoSaver Website</a></p>
|
||||
@ -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: `
|
||||
<h1>API Token</h1>
|
||||
<p><strong>Token:</strong> ${token}</p>
|
||||
<p>Please do not lose this token and do not share your token with anyone!</p>
|
||||
<p>Thank you for using EcoSaver.</p>
|
||||
<p>Regards,</p>
|
||||
<p>EcoSaver Team</p>
|
||||
<p><a href="https://ecosaver.teeseng.uk/">EcoSaver Website</a></p>
|
||||
<p>Please do not reply to this email.</p>
|
||||
|
||||
`,
|
||||
});
|
||||
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 };
|
||||
|
@ -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!",
|
||||
});
|
||||
|
@ -3,10 +3,10 @@
|
||||
<body>
|
||||
<section class="wrapper">
|
||||
<div class="form">
|
||||
<header>Reset Password</header>
|
||||
<form action="auth/checkemail" method="POST" onsubmit="formAJAX(this)">
|
||||
<header>Forgot Password</header>
|
||||
<form action="auth/checkemail" onsubmit="formAJAX(this)" evalAJAX="app.auth.logInRedirect();">
|
||||
<input type="email" name="email" placeholder="Email" required
|
||||
pattern="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
|
||||
pattern="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
|
||||
<input type="submit" value="Reset Password" />
|
||||
</form>
|
||||
<br>
|
||||
|
@ -1,30 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Your password has been resetted</title>
|
||||
<link href="css/reset.css" rel="stylesheet">
|
||||
</head>
|
||||
<%- include('logintop') %>
|
||||
|
||||
<body>
|
||||
|
||||
<table class="main-header">
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<img src="images/passwordreset.png" alt="Image">
|
||||
<h1>Your password has been resetted</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="content-section">
|
||||
<tr>
|
||||
<td>
|
||||
<p>Hello,</p>
|
||||
<p>Please check your email to reset your password.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<section class="wrapper">
|
||||
<div class="form">
|
||||
<header>Reset Password</header>
|
||||
<form action="auth/resetPassword" >
|
||||
<input type="password" name="password" placeholder="password" required>
|
||||
<input type="cpassword" name="cpassword" placeholder="cpassword" required>
|
||||
<input type="submit" value="Reset Password" />
|
||||
</form>
|
||||
<br>
|
||||
<a>Dont have an account?</a> <a href="/login">Sign Up</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<table class="footer">
|
||||
<tr>
|
||||
@ -35,5 +24,3 @@
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user