format errors from auth-jwt plugin similarly to other authentication errors (#6553)
This commit is contained in:
parent
22587672ec
commit
ee39025cf7
|
@ -173,7 +173,7 @@ export default Component.extend(DEFAULTS, {
|
|||
|
||||
showLoading: or('isLoading', 'authenticate.isRunning', 'fetchMethods.isRunning', 'unwrapToken.isRunning'),
|
||||
|
||||
handleError(e) {
|
||||
handleError(e, prefixMessage = true) {
|
||||
this.set('loading', false);
|
||||
if (!e.errors) {
|
||||
return e;
|
||||
|
@ -184,7 +184,8 @@ export default Component.extend(DEFAULTS, {
|
|||
}
|
||||
return error;
|
||||
});
|
||||
this.set('error', `Authentication failed: ${errors.join('.')}`);
|
||||
let message = prefixMessage ? 'Authentication failed: ' : '';
|
||||
this.set('error', `${message}${errors.join('.')}`);
|
||||
},
|
||||
|
||||
authenticate: task(function*(backendType, data) {
|
||||
|
@ -239,5 +240,12 @@ export default Component.extend(DEFAULTS, {
|
|||
}
|
||||
return this.authenticate.unlinked().perform(backend.type, data);
|
||||
},
|
||||
handleError(e) {
|
||||
if (e) {
|
||||
this.handleError(e, false);
|
||||
} else {
|
||||
this.set('error', null);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
{{/if}}
|
||||
{{#if (or (eq this.selectedAuthBackend.type "jwt") (eq this.selectedAuthBackend.type "oidc"))}}
|
||||
<AuthJwt
|
||||
@onError={{action (mut this.error)}}
|
||||
@onError={{action "handleError"}}
|
||||
@onLoading={{action (mut this.isLoading)}}
|
||||
@onToken={{action (mut this.token)}}
|
||||
@namespace={{this.namespace}}
|
||||
|
|
Loading…
Reference in New Issue