diff --git a/src/services/api/routes/v1/email.js b/src/services/api/routes/v1/email.js
index b3c9ce6..561e651 100644
--- a/src/services/api/routes/v1/email.js
+++ b/src/services/api/routes/v1/email.js
@@ -1,6 +1,7 @@
const router = require('express').Router();
const moment = require('moment');
const { PNID } = require('../../../../models/pnid');
+const util = require('../../../../util');
router.get('/verify', async (request, response) => {
const { token } = request.query;
@@ -33,6 +34,8 @@ router.get('/verify', async (request, response) => {
await pnid.save();
+ await util.sendEmailConfirmedEmail(pnid);
+
response.status(200).send('Email validated. You may close this window');
});
diff --git a/src/services/nnid/routes/support.js b/src/services/nnid/routes/support.js
index d2a43b2..4b808a7 100644
--- a/src/services/nnid/routes/support.js
+++ b/src/services/nnid/routes/support.js
@@ -84,6 +84,8 @@ router.put('/email_confirmation/:pid/:code', async (request, response) => {
await pnid.save();
+ await util.sendEmailConfirmedEmail(pnid);
+
response.status(200).send('');
});
diff --git a/src/util.js b/src/util.js
index 9518b9e..c265699 100644
--- a/src/util.js
+++ b/src/util.js
@@ -232,8 +232,16 @@ function nascError(errorCode) {
async function sendConfirmationEmail(pnid) {
await mailer.sendMail({
to: pnid.get('email.address'),
- subject: '[Pretendo Network] Please confirm your e-mail address',
- html: `Hello,
Your Pretendo Network ID activation is almost complete. Please click the link below to confirm your e-mail address and complete the activation process.
https://api.pretendo.cc/v1/email/verify?token=${pnid.get('identification.email_token')}
If you are unable to connect to the above URL, please enter the following confirmation code on the device to which your Prentendo Network ID is linked.
<<Confirmation code: ${pnid.get('identification.email_code')}>>`
+ subject: '[Pretendo Network] Please confirm your email address',
+ html: `Hello,
Your Pretendo Network ID activation is almost complete.
Please click the link below to confirm your e-mail address and complete the activation process.
https://api.pretendo.cc/v1/email/verify?token=${pnid.get('identification.email_token')}
If you are unable to connect to the above URL, please enter the following confirmation code on the device to which your Prentendo Network ID is linked.
<<Confirmation code: ${pnid.get('identification.email_code')}>>`
+ });
+}
+
+async function sendEmailConfirmedEmail(pnid) {
+ await mailer.sendMail({
+ to: pnid.get('email.address'),
+ subject: '[Pretendo Network] Email address confirmed',
+ html: 'Your email address has been confirmed!'
});
}
@@ -247,5 +255,6 @@ module.exports = {
fullUrl,
uploadCDNAsset,
nascError,
- sendConfirmationEmail
+ sendConfirmationEmail,
+ sendEmailConfirmedEmail
};
\ No newline at end of file