Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
m4lab_tv1
User Account
Commits
49e5a58d
Commit
49e5a58d
authored
Feb 28, 2020
by
Rosanny Sihombing
Browse files
update forgot password email and user feedback
parent
5523f3fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
routes/routes.js
View file @
49e5a58d
...
...
@@ -350,10 +350,10 @@ module.exports = function (app, config, passport) {
//methods.currentDate();
var
emailAddress
=
req
.
body
.
inputEmail
;
var
emailContent
=
"
Hi there,
\n\n
"
+
/*
var emailContent = "Hi there,\n\n"+
"we've received a request to reset your password. However, this email address is not on our database of registered users.\n\n"+
"Thanks,\nM4_LAB Team";
var
emailSubject
=
"
Account Access Attempted
"
;
var emailSubject = "Account Access Attempted";
*/
async
.
waterfall
([
function
(
done
)
{
...
...
@@ -366,8 +366,8 @@ module.exports = function (app, config, passport) {
methods
.
checkUserEmail
(
emailAddress
,
function
(
err
,
user
){
if
(
user
)
{
console
.
log
(
"
email: user found
"
);
emailSubject
=
"
M4_LAB Password Reset
"
;
emailContent
=
"
Hi User,
\n\n
"
+
var
emailSubject
=
"
M4_LAB Password Reset
"
;
var
emailContent
=
"
Hi User,
\n\n
"
+
"
we've received a request to reset your password. If you didn't make the request, just ignore this email.
\n\n
"
+
"
Otherwise, you can reset your password using this link: http://localhost:9989/reset/
"
+
token
+
"
\n
"
+
"
This password reset is only valid for 1 hour.
\n\n
"
+
...
...
@@ -381,12 +381,22 @@ module.exports = function (app, config, passport) {
methods
.
updateCredential
(
credentialData
,
function
(
err
)
{
done
(
err
,
token
,
user
);
});
// send email
mailOptions
.
to
=
emailAddress
;
mailOptions
.
subject
=
emailSubject
;
mailOptions
.
text
=
emailContent
;
smtpTransport
.
sendMail
(
mailOptions
,
function
(
err
)
{
done
(
err
,
'
done
'
);
});
}
else
{
done
(
err
,
null
,
null
);
//done(err, null, null);
done
(
err
,
'
no user found
'
);
}
});
},
}
/*,
function(token, user, done) {
mailOptions.to = emailAddress;
mailOptions.subject = emailSubject;
...
...
@@ -394,13 +404,13 @@ module.exports = function (app, config, passport) {
smtpTransport.sendMail(mailOptions, function(err) {
done(err, 'done');
});
}
}
*/
],
function
(
err
)
{
if
(
err
)
{
req
.
flash
(
'
error
'
,
'
An error occured. Please try again.
'
);
}
else
{
req
.
flash
(
'
success
'
,
'
A
n e-mail has been sent to
'
+
emailAddress
+
'
with further instructions.
'
);
req
.
flash
(
'
success
'
,
'
If your email is registered, a
n e-mail has been sent to
'
+
emailAddress
+
'
with further instructions.
'
);
}
res
.
redirect
(
'
/forgotPwd
'
);
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment