mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-10-02 07:08:23 -05:00
Added email for when email address is confirmed
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ router.put('/email_confirmation/:pid/:code', async (request, response) => {
|
||||
|
||||
await pnid.save();
|
||||
|
||||
await util.sendEmailConfirmedEmail(pnid);
|
||||
|
||||
response.status(200).send('');
|
||||
});
|
||||
|
||||
|
||||
15
src/util.js
15
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,<br><br>Your Pretendo Network ID activation is almost complete. Please click the link below to confirm your e-mail address and complete the activation process.<br><br>https://api.pretendo.cc/v1/email/verify?token=${pnid.get('identification.email_token')}<br><br>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.<br><br><<Confirmation code: ${pnid.get('identification.email_code')}>>`
|
||||
subject: '[Pretendo Network] Please confirm your email address',
|
||||
html: `Hello,<br><br>Your Pretendo Network ID activation is almost complete.<br><br>Please click the link below to confirm your e-mail address and complete the activation process.<br><br>https://api.pretendo.cc/v1/email/verify?token=${pnid.get('identification.email_token')}<br><br>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.<br><br><<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
|
||||
};
|
||||
Reference in New Issue
Block a user