Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
m4lab_tv1
User Account
Commits
424fc8a4
Commit
424fc8a4
authored
4 years ago
by
Rosanny Sihombing
Browse files
Options
Download
Email Patches
Plain Diff
MLAB-129: add welcome email after successful verification
parent
e7931881
master
MLAB-677
devel
patch-1
reset-jul13
reset-merge
testing
7 merge requests
!143
updating yml config
,
!64
Prepare production
,
!63
Prepare after testing
,
!62
Testing
,
!59
Mlab 240
,
!40
Mlab 26
,
!34
MLAB 129
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
routes/methods.js
+13
-0
routes/methods.js
routes/routes-account.js
+25
-2
routes/routes-account.js
with
38 additions
and
2 deletions
+38
-2
routes/methods.js
+
13
-
0
View file @
424fc8a4
...
...
@@ -80,6 +80,19 @@ var methods = {
}
callback
(
user
,
err
);
});
},
getUserById
:
function
(
userId
,
callback
)
{
dbconn
.
user
.
query
(
'
SELECT verificationStatus, email, salutation, title, firstname, lastname, industry, organisation, speciality FROM user WHERE id =
'
+
userId
,
function
(
err
,
rows
,
fields
)
{
if
(
err
)
{
throw
err
;
}
else
{
if
(
rows
.
length
>
0
)
{
user
=
rows
[
0
];
}
}
callback
(
user
,
err
);
});
},
checkUserEmail
:
function
(
email
,
callback
)
{
let
user
...
...
This diff is collapsed.
Click to expand it.
routes/routes-account.js
+
25
-
2
View file @
424fc8a4
...
...
@@ -581,9 +581,8 @@ module.exports = function (app, config, passport, i18n) {
// ============= USER VERIFICATION ================================
app
.
get
(
"
/verifyAccount
"
,
function
(
req
,
res
){
console
.
log
(
req
.
query
)
methods
.
getUserIdByVerificationToken
(
req
.
query
.
token
,
function
(
userId
,
err
){
console
.
log
(
err
)
console
.
log
(
userId
)
if
(
userId
)
{
let
userData
=
{
id
:
userId
,
...
...
@@ -597,6 +596,30 @@ module.exports = function (app, config, passport, i18n) {
});
}
else
{
// send welcome email after successful account verification
methods
.
getUserById
(
userId
,
function
(
data
,
err
){
if
(
err
)
{
console
.
log
(
"
Error:
"
+
err
)
}
else
{
// send email
var
emailSubject
=
"
Herzlich willkommen
"
var
emailContent
=
"
Lieber Nutzer,
\n\n
"
+
"
herzlich willkommen beim Transferportal der HFT Stuttgart!
\n
"
+
"
Sie können nun alle Dienste des Portals nutzen.
\n\n
"
+
mailSignature
mailer
.
options
.
to
=
data
.
email
;
mailer
.
options
.
subject
=
emailSubject
;
mailer
.
options
.
text
=
emailContent
;
mailer
.
transport
.
sendMail
(
mailer
.
options
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
'
cannot send email
'
)
throw
err
}
})
}
})
res
.
render
(
lang
+
'
/account/verification
'
,
{
status
:
true
});
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets