Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions api/cloud_api/email_templates/blastEmail.js

This file was deleted.

32 changes: 15 additions & 17 deletions api/cloud_api/email_templates/membershipConfirmationCode.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
function membershipConfirmationCode(user, recipient, confirmCode) {
return new Promise((resolve, reject) => {
return resolve({
from: user,
to: recipient,
subject: `Your SCE Membership Code Is ${confirmCode}`,
generateTextFromHTML: true,
html: `
<p>
Hi, <br />
Thank you for signing up for membership! <br />
Please use the below confirmation code when you
visit your profile page on the
SCE website to verify your membership: <br /> <b>${confirmCode}</b>
</p>
`
});
});
return {
from: user,
to: recipient,
subject: `Your SCE Membership Code Is ${confirmCode}`,
generateTextFromHTML: true,
html: `
<p>
Hi, <br />
Thank you for signing up for membership! <br />
Please use the below confirmation code when you
visit your profile page on the
SCE website to verify your membership: <br /> <b>${confirmCode}</b>
</p>
`
};
}
module.exports = { membershipConfirmationCode };
40 changes: 16 additions & 24 deletions api/cloud_api/email_templates/passwordReset.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
const generateHashedId = require('../util/auth').generateHashedId;

function passwordReset(user, resetToken, recipient) {
return new Promise((resolve, reject) => {
generateHashedId(recipient)
.then(hashedId => {
const url =
process.env.VERIFICATION_BASE_URL || 'http://localhost:3000';
const resetLink =
`${url}/reset?id=${hashedId}&resetToken=${resetToken}`;
return resolve({
from: user,
to: recipient,
subject: 'Reset Password for SCE',
generateTextFromHTML: true,
html: `
Hi,<br />
<p>Click the link below to reset your password. It will expire in 24 hours.</p>
<a href='${resetLink}'>Reset Password</a>
`
});
})
.catch(error => {
reject(error);
});
});
function passwordReset(hashedId, user, resetToken, recipient) {
const url =
process.env.VERIFICATION_BASE_URL || 'http://localhost:3000';
const resetLink =
`${url}/reset?id=${hashedId}&resetToken=${resetToken}`;
return {
from: user,
to: recipient,
subject: 'Reset Password for SCE',
generateTextFromHTML: true,
html: `
Hi,<br />
<p>Click the link below to reset your password. It will expire in 24 hours.</p>
<a href='${resetLink}'>Reset Password</a>
`
};
}

module.exports = { passwordReset };
12 changes: 0 additions & 12 deletions api/cloud_api/email_templates/test.js

This file was deleted.

20 changes: 9 additions & 11 deletions api/cloud_api/email_templates/unsubscribeEmail.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
function unsubscribeEmail(user, recipient, name) {
return new Promise((resolve, reject) => {
const url =
const url =
process.env.VERIFICATION_BASE_URL || 'http://localhost:3000';
const verifyLink =
const verifyLink =
`${url}/emailPreferences?user=${recipient}`;
return resolve({
from: user,
to: recipient,
subject: 'Unsubscribe from SCE Emails',
generateTextFromHTML: true,
html: `
return {
from: user,
to: recipient,
subject: 'Unsubscribe from SCE Emails',
generateTextFromHTML: true,
html: `
Hi ${name || ''},<br />
<p>We appreciate you reducing email spam.
To opt out of all our emails, click the link below
Expand All @@ -18,8 +17,7 @@ function unsubscribeEmail(user, recipient, name) {
<p>Thanks,</p>
<p>The Software and Computer Engineering Society</p>
`
});
});
};
}

module.exports = { unsubscribeEmail };
42 changes: 17 additions & 25 deletions api/cloud_api/email_templates/verification.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
const generateHashedId = require('../util/auth').generateHashedId;

function verification(user, recipient, name) {
return new Promise((resolve, reject) => {
generateHashedId(recipient)
.then(hashedId => {
const url =
process.env.VERIFICATION_BASE_URL || 'http://localhost:3000';
const verifyLink =
`${url}/verify?id=${hashedId}&user=${recipient}`;
return resolve({
from: user,
to: recipient,
subject: 'Please verify your email address',
generateTextFromHTML: true,
html: `
Hi ${name || ''},<br />
<p>Thanks for signing up!
Please verify your email by clicking below.</p>
<a href='${verifyLink}'>Verify Email</a>
`
});
})
.catch(error => {
reject(error);
});
});
function verification(hashedId, user, recipient, name) {
const url =
process.env.VERIFICATION_BASE_URL || 'http://localhost:3000';
const verifyLink =
`${url}/verify?id=${hashedId}&user=${recipient}`;
return {
from: user,
to: recipient,
subject: 'Please verify your email address',
generateTextFromHTML: true,
html: `
Hi ${name || ''},<br />
<p>Thanks for signing up!
Please verify your email by clicking below.</p>
<a href='${verifyLink}'>Verify Email</a>
`
};
}

module.exports = { verification };
Loading
Loading