Skip to content

Commit

Permalink
Merge pull request #722 from UofT-Frosh-Orientation/adding-email-conf…
Browse files Browse the repository at this point in the history
…irmation-token-to-environment

Email confirmation token
  • Loading branch information
Freeassassin authored Aug 14, 2023
2 parents e2dced6 + b9655b6 commit 15c8dfe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ services:
- STRIPE_EARLY_BIRD_COUPON_ID=$STRIPE_EARLY_BIRD_COUPON_ID
- STRIPE_RETREAT_PRICE_ID=$STRIPE_RETREAT_PRICE_ID
- JWT_RESET_TOKEN=$JWT_RESET_TOKEN
- JWT_EMAIL_CONFIRMATION_TOKEN=$JWT_EMAIL_CONFIRMATION_TOKEN
- REGISTRATION_DATA_EMAIL_ADDRESSES=$REGISTRATION_DATA_EMAIL_ADDRESSES
- RETREAT_MAX_TICKETS=$RETREAT_MAX_TICKETS
- USER_SESSION_SECRET=$USER_SESSION_SECRET
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/UserServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const UserServices = {

async validateEmailConfirmationToken(token) {
return new Promise((resolve, reject) => {
jwt.verify(token, process.env.JWT_RESET_TOKEN, (err, decoded) => {
jwt.verify(token, process.env.JWT_EMAIL_CONFIRMATION_TOKEN, (err, decoded) => {
if (err) {
reject(err);
} else {
Expand Down
7 changes: 6 additions & 1 deletion server/src/subscribers/emailConfirmationSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ const emailConfirmationSubscription = new Queue('newUser', {
emailConfirmationSubscription.process((job, done) => {
try {
// sending user email verification link
const emailToken = jwt.sign(job.data.email, process.env.JWT_RESET_TOKEN);
const emailToken = jwt.sign(
job.data.email,
process.env.JWT_EMAIL_CONFIRMATION_TOKEN,
);

const url =
process.env.CLIENT_BASE_URL + '/verify-user-email/' + job.data.email + '/' + emailToken;

EmailServices.sendSimpleEmail(
[job.data.email],
'',
Expand Down

0 comments on commit 15c8dfe

Please sign in to comment.