mirror of https://github.com/rancher/ui.git
Different login error message for user/pass vs button
This commit is contained in:
parent
2f1715c62b
commit
34630e6c8e
|
|
@ -6,6 +6,8 @@ import { inject as service } from '@ember/service';
|
|||
import Controller from '@ember/controller';
|
||||
import { on } from '@ember/object/evented';
|
||||
|
||||
const USER_PASS_PROVIDERS = ['local','activedirectory'];
|
||||
|
||||
export default Controller.extend({
|
||||
queryParams : ['errorMsg', 'resetPassword', 'errorCode'],
|
||||
access : service(),
|
||||
|
|
@ -23,7 +25,7 @@ export default Controller.extend({
|
|||
}),
|
||||
|
||||
isOpenLdap: computed('access.provider', function() {
|
||||
return !!get(this, 'access.providers').findBy('id', 'openldapconfig');
|
||||
return !!get(this, 'access.providers').findBy('id', 'openldap');
|
||||
}),
|
||||
|
||||
isLocal: computed('access.providers', function() {
|
||||
|
|
@ -36,11 +38,11 @@ export default Controller.extend({
|
|||
}),
|
||||
|
||||
isAzureAd: computed('access.provider', function() {
|
||||
return !!get(this, 'access.providers').findBy('id', 'azureadconfig');
|
||||
return !!get(this, 'access.providers').findBy('id', 'azuread');
|
||||
}),
|
||||
|
||||
isShibboleth: computed('access.provider', function() {
|
||||
return !!get(this, 'access.providers').findBy('id', 'shibbolethconfig');
|
||||
return !!get(this, 'access.providers').findBy('id', 'shibboleth');
|
||||
}),
|
||||
|
||||
isCaas: computed('app.mode', function() {
|
||||
|
|
@ -97,7 +99,12 @@ export default Controller.extend({
|
|||
set(this, 'changePassword', false);
|
||||
|
||||
if ( err && err.status === 401 ) {
|
||||
set(this, 'errorMsg', get(this, 'intl').t('loginPage.error.authFailed'));
|
||||
let key = 'loginPage.error.authFailed'
|
||||
if ( USER_PASS_PROVIDERS.includes(provider) ) {
|
||||
key = 'loginPage.error.authFailedCreds';
|
||||
}
|
||||
|
||||
set(this, 'errorMsg', get(this, 'intl').t(key));
|
||||
} else {
|
||||
set(this, 'errorMsg', (err ? err.message : "No response received"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,48 +27,41 @@
|
|||
{{#if isShibboleth}}
|
||||
<p>{{t 'loginPage.shibbolethMessage' appName=settings.appName}}</p>
|
||||
<br/>
|
||||
{{login-shibboleth
|
||||
action="started"
|
||||
waiting=waiting
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{#if infoMsg}}
|
||||
<div class="banner p-10 {{if errorMsg 'bg-error' 'bg-warning'}}" role="alert">
|
||||
{{infoMsg}}
|
||||
{{#if (and isGithub isForbidden)}}
|
||||
<br/>
|
||||
<br/>
|
||||
<div>
|
||||
{{t 'loginGithub.thirdPartyAccessLimitation' htmlSafe=true}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if isCaas}}
|
||||
{{caas-login promptReset=(mut promptPasswordReset)}}
|
||||
{{/if}}
|
||||
{{#if isShibboleth}}
|
||||
{{login-shibboleth action="started" waiting=waiting}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
||||
{{#if isCaas}}
|
||||
{{caas-login promptReset=(mut promptPasswordReset)}}
|
||||
{{/if}}
|
||||
|
||||
{{!-- {{#if (or isLocal isActiveDirectory isOpenLdap isAzureAd)}} --}}
|
||||
{{#if isActiveDirectory}}
|
||||
{{login-user-pass
|
||||
{{#if isActiveDirectory}}
|
||||
{{login-user-pass
|
||||
classNames="row"
|
||||
action="authenticate"
|
||||
waiting=waiting
|
||||
provider="activedirectory"
|
||||
}}
|
||||
{{/if}}
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isLocal}}
|
||||
{{login-user-pass
|
||||
{{#if isLocal}}
|
||||
{{login-user-pass
|
||||
classNames="row"
|
||||
action="authenticate"
|
||||
waiting=waiting
|
||||
shown=onlyLocal
|
||||
provider="local"
|
||||
}}
|
||||
{{/if}}
|
||||
}}
|
||||
{{/if}}
|
||||
|
||||
{{#if infoMsg}}
|
||||
<div class="banner p-10 {{if errorMsg 'bg-error' 'bg-warning'}}" role="alert">
|
||||
{{infoMsg}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
||||
{{#if app.initError}}
|
||||
{{banner-message color='bg-error' icon='icon-alert' message=app.initError.message}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue