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 Controller from '@ember/controller';
|
||||||
import { on } from '@ember/object/evented';
|
import { on } from '@ember/object/evented';
|
||||||
|
|
||||||
|
const USER_PASS_PROVIDERS = ['local','activedirectory'];
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
queryParams : ['errorMsg', 'resetPassword', 'errorCode'],
|
queryParams : ['errorMsg', 'resetPassword', 'errorCode'],
|
||||||
access : service(),
|
access : service(),
|
||||||
|
|
@ -23,7 +25,7 @@ export default Controller.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isOpenLdap: computed('access.provider', function() {
|
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() {
|
isLocal: computed('access.providers', function() {
|
||||||
|
|
@ -36,11 +38,11 @@ export default Controller.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
isAzureAd: computed('access.provider', function() {
|
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() {
|
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() {
|
isCaas: computed('app.mode', function() {
|
||||||
|
|
@ -97,7 +99,12 @@ export default Controller.extend({
|
||||||
set(this, 'changePassword', false);
|
set(this, 'changePassword', false);
|
||||||
|
|
||||||
if ( err && err.status === 401 ) {
|
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 {
|
} else {
|
||||||
set(this, 'errorMsg', (err ? err.message : "No response received"));
|
set(this, 'errorMsg', (err ? err.message : "No response received"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,30 +27,16 @@
|
||||||
{{#if isShibboleth}}
|
{{#if isShibboleth}}
|
||||||
<p>{{t 'loginPage.shibbolethMessage' appName=settings.appName}}</p>
|
<p>{{t 'loginPage.shibbolethMessage' appName=settings.appName}}</p>
|
||||||
<br/>
|
<br/>
|
||||||
|
{{login-shibboleth
|
||||||
|
action="started"
|
||||||
|
waiting=waiting
|
||||||
|
}}
|
||||||
{{/if}}
|
{{/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}}
|
|
||||||
{{#if isShibboleth}}
|
|
||||||
{{login-shibboleth action="started" waiting=waiting}}
|
|
||||||
{{/if}}
|
|
||||||
{{/unless}}
|
|
||||||
|
|
||||||
{{#if isCaas}}
|
{{#if isCaas}}
|
||||||
{{caas-login promptReset=(mut promptPasswordReset)}}
|
{{caas-login promptReset=(mut promptPasswordReset)}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{!-- {{#if (or isLocal isActiveDirectory isOpenLdap isAzureAd)}} --}}
|
|
||||||
{{#if isActiveDirectory}}
|
{{#if isActiveDirectory}}
|
||||||
{{login-user-pass
|
{{login-user-pass
|
||||||
classNames="row"
|
classNames="row"
|
||||||
|
|
@ -70,6 +56,13 @@
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if infoMsg}}
|
||||||
|
<div class="banner p-10 {{if errorMsg 'bg-error' 'bg-warning'}}" role="alert">
|
||||||
|
{{infoMsg}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
{{#if app.initError}}
|
{{#if app.initError}}
|
||||||
{{banner-message color='bg-error' icon='icon-alert' message=app.initError.message}}
|
{{banner-message color='bg-error' icon='icon-alert' message=app.initError.message}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue