mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
🎨 Improved copy on too many login attempts
fixes https://github.com/TryGhost/Team/issues/2391
This commit is contained in:
parent
49931d05e7
commit
fd2ef61b3c
3 changed files with 67 additions and 60 deletions
|
@ -58,6 +58,8 @@ export default class SigninController extends Controller.extend(ValidationEngine
|
|||
return this.notifications.showAPIError(error);
|
||||
}
|
||||
|
||||
this.signin.errors.clear();
|
||||
|
||||
if (error && error.payload && error.payload.errors) {
|
||||
let [mainError] = error.payload.errors;
|
||||
|
||||
|
@ -66,6 +68,11 @@ export default class SigninController extends Controller.extend(ValidationEngine
|
|||
|
||||
this.flowErrors = (mainError.context.string || mainError.message.string);
|
||||
|
||||
if (mainError.type === 'TooManyRequestsError') {
|
||||
// Prefer full message in this case
|
||||
this.flowErrors = mainError.message.string;
|
||||
}
|
||||
|
||||
if (mainError.type === 'PasswordResetRequiredError') {
|
||||
this.passwordResetEmailSent = true;
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ const userLogin = () => {
|
|||
attachResetToRequest: true,
|
||||
failCallback(req, res, next, nextValidRequestDate) {
|
||||
return next(new errors.TooManyRequestsError({
|
||||
message: `Too many sign-in attempts try again in ${moment(nextValidRequestDate).fromNow(true)}`,
|
||||
message: `Too many login attempts. Please wait ${moment(nextValidRequestDate).fromNow(true)} before trying again, or reset your password.`,
|
||||
context: tpl(messages.tooManySigninAttempts.context),
|
||||
help: tpl(messages.tooManySigninAttempts.context)
|
||||
}));
|
||||
|
|
Loading…
Add table
Reference in a new issue