mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Improved error handling in setup/two screen
no issue - display the `context` property of any API errors so that the messages are useful - use the same email/password that was used for the setup request in the session request to avoid issues with keys being hit after Enter
This commit is contained in:
parent
ea3c986f63
commit
f3cfafe6ac
1 changed files with 5 additions and 3 deletions
|
@ -143,7 +143,7 @@ export default Controller.extend(ValidationEngine, {
|
||||||
// Don't call the success handler, otherwise we will be redirected to admin
|
// Don't call the success handler, otherwise we will be redirected to admin
|
||||||
this.set('session.skipAuthSuccessHandler', true);
|
this.set('session.skipAuthSuccessHandler', true);
|
||||||
|
|
||||||
return this.session.authenticate('authenticator:cookie', this.email, this.password).then(() => {
|
return this.session.authenticate('authenticator:cookie', data.email, data.password).then(() => {
|
||||||
this.set('blogCreated', true);
|
this.set('blogCreated', true);
|
||||||
return this._afterAuthentication(result);
|
return this._afterAuthentication(result);
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
@ -161,7 +161,8 @@ export default Controller.extend(ValidationEngine, {
|
||||||
|
|
||||||
_handleSaveError(resp) {
|
_handleSaveError(resp) {
|
||||||
if (isInvalidError(resp)) {
|
if (isInvalidError(resp)) {
|
||||||
this.set('flowErrors', resp.payload.errors[0].message);
|
let [error] = resp.payload.errors;
|
||||||
|
this.set('flowErrors', `${error.message} ${error.context}`);
|
||||||
} else {
|
} else {
|
||||||
this.notifications.showAPIError(resp, {key: 'setup.blog-details'});
|
this.notifications.showAPIError(resp, {key: 'setup.blog-details'});
|
||||||
}
|
}
|
||||||
|
@ -169,7 +170,8 @@ export default Controller.extend(ValidationEngine, {
|
||||||
|
|
||||||
_handleAuthenticationError(error) {
|
_handleAuthenticationError(error) {
|
||||||
if (error && error.payload && error.payload.errors) {
|
if (error && error.payload && error.payload.errors) {
|
||||||
this.set('flowErrors', error.payload.errors[0].message);
|
let [apiError] = error.payload.errors;
|
||||||
|
this.set('flowErrors', `${apiError.message} ${apiError.context}`);
|
||||||
} else {
|
} else {
|
||||||
// Connection errors don't return proper status message, only req.body
|
// Connection errors don't return proper status message, only req.body
|
||||||
this.notifications.showAlert('There was a problem on the server.', {type: 'error', key: 'setup.authenticate.failed'});
|
this.notifications.showAlert('There was a problem on the server.', {type: 'error', key: 'setup.authenticate.failed'});
|
||||||
|
|
Loading…
Add table
Reference in a new issue