Update email views and notifications

This commit is contained in:
Mrugesh Mohapatra
2017-02-07 01:33:09 +05:30
committed by Berkeley Martinez
parent f3804bb553
commit 5c56a1e78c
4 changed files with 27 additions and 23 deletions

View File

@ -570,11 +570,7 @@ module.exports = function(User) {
};
return User.findOrCreate$({ where: { email }}, userObj)
.map(([ err, user, isCreated ]) => {
if (err) {
return dedent`
Oops, something is not right, please try again later.
`;
}
if (err) { throw err; }
const minutesLeft = getWaitPeriod(user.emailAuthLinkTTL);
if (minutesLeft) {
@ -596,13 +592,15 @@ module.exports = function(User) {
const { id: loginToken } = token;
const loginEmail = user.email;
const host = isDev ?
'http://localhost:3000' : 'https://freecodecamp.com';
const mailOptions = {
type: 'email',
to: user.email,
from: 'Team@freecodecamp.com',
subject: 'freeCodeCamp - Authentication Request!',
text: renderAuthEmail({
host,
loginEmail,
loginToken
})
@ -622,14 +620,16 @@ module.exports = function(User) {
this.emailAuthLinkTTL = emailAuthLinkTTL;
});
return dedent`
If you entered a valid email, a magic link is on its way.
Please follow that link to sign in.
`;
});
})
.map((msg) => {
if (msg) { return msg; }
.map(() => {
return dedent`
If you entered a valid email, a magic link is on its way.
Please follow that link to sign in.
`;
})
.catch(err => {
if (err) { debug(err); }
return dedent`
Oops, something is not right, please try again later.
`;

View File

@ -258,7 +258,7 @@ module.exports = function(app) {
return res.redirect('/');
}
return User.requestAuthLink(req.body.email, 'user-request-sign-in.ejs')
return User.requestAuthLink(req.body.email)
.then(msg => {
return res.status(200).send({ message: msg });
})

View File

@ -1,12 +1,14 @@
Greetings from San Francisco!
You can now sign in to freeCodeCamp, without a password. Just follow the link below:
Please follow the link below, and sign in to freeCodeCamp instantly:
https://freecodecamp.com/passwordless-auth?email=<%= loginEmail %>&token=<%= loginToken %>
<%= host %>/passwordless-auth?email=<%= loginEmail %>&token=<%= loginToken %>
This above link is valid for 15 minutes.
IMPORTANT NOTE:
You can simply delete or ignore this email, if you did not make any such request.
Do not share this email with anyone, doing so may give them access to your account.
If you did not make any such request, simply delete or ignore this email.
Do not share this email with anyone, doing so will give them access to your account.
Good luck with the challenges!

View File

@ -1,19 +1,21 @@
Greetings from San Francisco!
Welcome to freeCodeCamp. We've created a new account for you.
To verify and start using your profile just follow the link below:
Please verify and start using your profile by following the link below:
https://freecodecamp.com/passwordless-auth?email=<%= loginEmail %>&token=<%= loginToken %>
<%= host %>/passwordless-auth?email=<%= loginEmail %>&token=<%= loginToken %>
Next steps:
1. Visit the settings page and link your account to Github.
This above link is valid for 15 minutes.
And when you have a moment:
1. Visit the settings page and link your account to GitHub.
2. Follow our Medium Publication: https://medium.freecodecamp.com
3. Checkout our forum: https://forum.freecodecamp.com
4. Join the conversation: https://gitter.im/FreeCodeCamp/FreeCodeCamp
IMPORTANT NOTE:
You can simply delete or ignore this email, if you did not make any such request.
Do not share this email with anyone, doing so may give them access to your account.
If you did not make any such request, simply delete or ignore this email.
Do not share this email with anyone, doing so will give them access to your account.
Good luck with the challenges!