-
Notifications
You must be signed in to change notification settings - Fork 31
created route to email users their confirmation code #1997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| if (!confirmCode) { | ||
| throw new Error('Confirmation code is required'); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to check this because the route already checks it
| throw new Error('Confirmation code is required'); | ||
| } | ||
|
|
||
| return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we wrap the return statement in a Promise, we should also reject the Promise if we catch an error, see unsubscribeEmail.js to see how to resolve/reject the Promise
| Thank you for signing up for membership! <br /> | ||
| Here is your confirmation code:</p> | ||
| <b>${confirmCode}</b> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include instructions about how they should confirm their membership, like "login to the SCE website and visit your profile to verify your membership" or something
api/cloud_api/routes/Mailer.js
Outdated
| }); | ||
| } | ||
|
|
||
| await membershipConfirmationCode(USER, req.body.recipientEmail, req.body.confirmationCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await membershipConfirmationCode(USER, req.body.recipientEmail, req.body.confirmationCode) | |
| await membershipConfirmationCode(USER, recipientEmail, confirmationCode) |
api/cloud_api/routes/Mailer.js
Outdated
| }) | ||
| .catch((err) => { | ||
| logger.error('unable to send confirmation code: ', err); | ||
| res.sendStatus(BAD_REQUEST); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| res.sendStatus(BAD_REQUEST); | |
| res.sendStatus(SERVER_ERROR); |
and make sure to import this status code at the top too. i know the other routes return bad request for failures but that's wrong
api/cloud_api/routes/Mailer.js
Outdated
| logger.error('unable to send member confirmation email: ', err); | ||
| res.sendStatus(BAD_REQUEST); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| logger.error('unable to send member confirmation email: ', err); | |
| res.sendStatus(BAD_REQUEST); | |
| logger.error('unable to generate member confirmation email template: ', err); | |
| res.sendStatus(SERVER_ERROR); |
adarshm11
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excellent
for issue #1987
created a simple email template and route to send confirmation codes