Update email views and notifications
This commit is contained in:
committed by
Berkeley Martinez
parent
f3804bb553
commit
5c56a1e78c
@ -570,11 +570,7 @@ module.exports = function(User) {
|
|||||||
};
|
};
|
||||||
return User.findOrCreate$({ where: { email }}, userObj)
|
return User.findOrCreate$({ where: { email }}, userObj)
|
||||||
.map(([ err, user, isCreated ]) => {
|
.map(([ err, user, isCreated ]) => {
|
||||||
if (err) {
|
if (err) { throw err; }
|
||||||
return dedent`
|
|
||||||
Oops, something is not right, please try again later.
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const minutesLeft = getWaitPeriod(user.emailAuthLinkTTL);
|
const minutesLeft = getWaitPeriod(user.emailAuthLinkTTL);
|
||||||
if (minutesLeft) {
|
if (minutesLeft) {
|
||||||
@ -596,13 +592,15 @@ module.exports = function(User) {
|
|||||||
|
|
||||||
const { id: loginToken } = token;
|
const { id: loginToken } = token;
|
||||||
const loginEmail = user.email;
|
const loginEmail = user.email;
|
||||||
|
const host = isDev ?
|
||||||
|
'http://localhost:3000' : 'https://freecodecamp.com';
|
||||||
const mailOptions = {
|
const mailOptions = {
|
||||||
type: 'email',
|
type: 'email',
|
||||||
to: user.email,
|
to: user.email,
|
||||||
from: 'Team@freecodecamp.com',
|
from: 'Team@freecodecamp.com',
|
||||||
subject: 'freeCodeCamp - Authentication Request!',
|
subject: 'freeCodeCamp - Authentication Request!',
|
||||||
text: renderAuthEmail({
|
text: renderAuthEmail({
|
||||||
|
host,
|
||||||
loginEmail,
|
loginEmail,
|
||||||
loginToken
|
loginToken
|
||||||
})
|
})
|
||||||
@ -622,14 +620,16 @@ module.exports = function(User) {
|
|||||||
this.emailAuthLinkTTL = emailAuthLinkTTL;
|
this.emailAuthLinkTTL = emailAuthLinkTTL;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.map(() => {
|
||||||
return dedent`
|
return dedent`
|
||||||
If you entered a valid email, a magic link is on its way.
|
If you entered a valid email, a magic link is on its way.
|
||||||
Please follow that link to sign in.
|
Please follow that link to sign in.
|
||||||
`;
|
`;
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.map((msg) => {
|
.catch(err => {
|
||||||
if (msg) { return msg; }
|
if (err) { debug(err); }
|
||||||
return dedent`
|
return dedent`
|
||||||
Oops, something is not right, please try again later.
|
Oops, something is not right, please try again later.
|
||||||
`;
|
`;
|
||||||
|
@ -258,7 +258,7 @@ module.exports = function(app) {
|
|||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
return User.requestAuthLink(req.body.email, 'user-request-sign-in.ejs')
|
return User.requestAuthLink(req.body.email)
|
||||||
.then(msg => {
|
.then(msg => {
|
||||||
return res.status(200).send({ message: msg });
|
return res.status(200).send({ message: msg });
|
||||||
})
|
})
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
Greetings from San Francisco!
|
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:
|
IMPORTANT NOTE:
|
||||||
You can simply delete or ignore this email, if you did not make any such request.
|
If you did not make any such request, simply delete or ignore this email.
|
||||||
Do not share this email with anyone, doing so may give them access to your account.
|
Do not share this email with anyone, doing so will give them access to your account.
|
||||||
|
|
||||||
Good luck with the challenges!
|
Good luck with the challenges!
|
||||||
|
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
Greetings from San Francisco!
|
Greetings from San Francisco!
|
||||||
|
|
||||||
Welcome to freeCodeCamp. We've created a new account for you.
|
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:
|
This above link is valid for 15 minutes.
|
||||||
1. Visit the settings page and link your account to Github.
|
|
||||||
|
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
|
2. Follow our Medium Publication: https://medium.freecodecamp.com
|
||||||
3. Checkout our forum: https://forum.freecodecamp.com
|
3. Checkout our forum: https://forum.freecodecamp.com
|
||||||
4. Join the conversation: https://gitter.im/FreeCodeCamp/FreeCodeCamp
|
4. Join the conversation: https://gitter.im/FreeCodeCamp/FreeCodeCamp
|
||||||
|
|
||||||
IMPORTANT NOTE:
|
IMPORTANT NOTE:
|
||||||
You can simply delete or ignore this email, if you did not make any such request.
|
If you did not make any such request, simply delete or ignore this email.
|
||||||
Do not share this email with anyone, doing so may give them access to your account.
|
Do not share this email with anyone, doing so will give them access to your account.
|
||||||
|
|
||||||
Good luck with the challenges!
|
Good luck with the challenges!
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user