1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

🐛 fix display/message bugs in re-auth modal (#770)

closes https://github.com/TryGhost/Ghost/issues/8656
- prevents button stretching from flexbox and adds margin between input and button
- use the `context` attribute returned from the server instead of the `message` so the error is now `Your password is incorrect.` instead of `You are not authorised to make this request.`
- return truthy/falsy values from the auth tasks so that the save-state button shows the correct state
This commit is contained in:
Kevin Ansfield 2017-07-06 11:18:20 +01:00 committed by Aileen Nowak
parent 5cd6335b57
commit 246d77811e
2 changed files with 8 additions and 4 deletions

View file

@ -45,16 +45,17 @@ export default ModalComponent.extend(ValidationEngine, {
this.set('authenticationError', null);
return this.validate({property: 'signin'}).then(() => {
this._authenticate().then(() => {
return this._authenticate().then(() => {
this.get('notifications').closeAlerts();
this.send('closeModal');
return true;
}).catch((error) => {
if (error && error.errors) {
error.errors.forEach((err) => {
if (isVersionMismatchError(err)) {
return this.get('notifications').showAPIError(error);
}
err.message = htmlSafe(err.message);
err.message = htmlSafe(err.context || err.message);
});
this.get('errors').add('password', 'Incorrect password');
@ -64,6 +65,7 @@ export default ModalComponent.extend(ValidationEngine, {
});
}, () => {
this.get('hasValidated').pushObject('password');
return false;
});
},
@ -95,9 +97,9 @@ export default ModalComponent.extend(ValidationEngine, {
reauthenticate: task(function* () {
if (this.get('config.ghostOAuth')) {
yield this._oauthConfirm();
return yield this._oauthConfirm();
} else {
yield this._passwordConfirm();
return yield this._passwordConfirm();
}
}).drop(),

View file

@ -183,8 +183,10 @@
@media (min-width: 901px) {
.modal-body .login-form {
display: flex;
align-items: center;
}
.modal-body .login-form .password-wrap {
flex: 1;
margin-right: 10px;
}
}