From 036ab413d33617a6225c1033ec1e0bf1f4e0eb6a Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 6 Jul 2017 11:18:20 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20display/message=20bugs=20i?= =?UTF-8?q?n=20re-auth=20modal=20(#770)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ghost/admin/app/components/modals/re-authenticate.js | 10 ++++++---- ghost/admin/app/styles/components/modals.css | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ghost/admin/app/components/modals/re-authenticate.js b/ghost/admin/app/components/modals/re-authenticate.js index b3d6e5e59e..df3ea710eb 100644 --- a/ghost/admin/app/components/modals/re-authenticate.js +++ b/ghost/admin/app/components/modals/re-authenticate.js @@ -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(), diff --git a/ghost/admin/app/styles/components/modals.css b/ghost/admin/app/styles/components/modals.css index 207d174ce5..f17b2222cd 100644 --- a/ghost/admin/app/styles/components/modals.css +++ b/ghost/admin/app/styles/components/modals.css @@ -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; } }