Fix indenting and remove isDev from wait time.

pull/12989/merge
Mrugesh Mohapatra 2016-11-20 16:21:13 +05:30 committed by Berkeley Martinez
parent 09174c9687
commit 19e5ff537e
2 changed files with 28 additions and 27 deletions

View File

@ -517,10 +517,10 @@ module.exports = function(User) {
.map(([ err, user, isCreated ]) => {
if (err) {
return dedent`
Oops, something is not right, please try again later.`;
Oops, something is not right, please try again later.
`;
}
if (!isDev) {
const minutesLeft = getWaitPeriod(user.emailAuthLinkTTL);
if (minutesLeft) {
const timeToWait = minutesLeft ?
@ -528,8 +528,8 @@ module.exports = function(User) {
'a few seconds';
debug('request before wait time : ' + timeToWait);
return dedent`
Please wait ${timeToWait} to resend an authentication link.`;
}
Please wait ${timeToWait} to resend an authentication link.
`;
}
let emailTemplate = 'user-request-sign-in.ejs';
@ -575,12 +575,14 @@ module.exports = function(User) {
return dedent`
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) => {
if (msg) { return msg; }
return dedent`
Oops, something is not right, please try again later.`;
Oops, something is not right, please try again later.
`;
})
.catch(error => {
debug(error);
@ -619,7 +621,6 @@ module.exports = function(User) {
));
}
if (!isDev) {
const minutesLeft = getWaitPeriod(this.emailVerifyTTL);
if (ownEmail && minutesLeft) {
const timeToWait = minutesLeft ?
@ -630,7 +631,6 @@ module.exports = function(User) {
`Please wait ${timeToWait} to resend email verification.`
));
}
}
return Observable.fromPromise(User.doesExist(null, email))
.flatMap(exists => {

View File

@ -161,7 +161,8 @@ module.exports = function(app) {
}
AccessToken.findOne$ = Observable.fromNodeCallback(
AccessToken.findOne, AccessToken);
AccessToken.findOne, AccessToken
);
router.get('/login', function(req, res) {
res.redirect(301, '/signin');