1
0
fixes de439ac5 and 7448f0e3
This commit is contained in:
Konstantin Demin 2024-07-01 23:16:56 +03:00
parent 7448f0e392
commit 0d49ad92df
5 changed files with 10 additions and 20 deletions

View File

@ -66,10 +66,6 @@ export default Component.extend(DEFAULTS, {
selectedAuth: newMethod, selectedAuth: newMethod,
oldSelectedAuth: oldMethod, oldSelectedAuth: oldMethod,
} = this; } = this;
// if we are cancelling the login then we reset the number challenge answer and cancel the current authenticate and polling tasks
if (cancelAuth) {
this.authenticate.cancelAll();
}
next(() => { next(() => {
if (!token && (oldNS === null || oldNS !== ns)) { if (!token && (oldNS === null || oldNS !== ns)) {
this.fetchMethods.perform(); this.fetchMethods.perform();

View File

@ -88,8 +88,5 @@ export default Controller.extend({
mfaErrors: null, mfaErrors: null,
}); });
}, },
cancelAuthentication() {
this.set('cancelAuth', true);
},
}, },
}); });

View File

@ -4,7 +4,6 @@
*/ */
import Model, { attr } from '@ember-data/model'; import Model, { attr } from '@ember-data/model';
import parseURL from 'core/utils/parse-url';
const DOMAIN_STRINGS = { const DOMAIN_STRINGS = {
}; };
@ -17,13 +16,6 @@ export default class RoleJwtModel extends Model {
@attr('string') authUrl; @attr('string') authUrl;
get providerName() { get providerName() {
const { hostname } = parseURL(this.authUrl); return null;
const firstMatch = Object.keys(DOMAIN_STRINGS).find((name) => hostname.includes(name));
return DOMAIN_STRINGS[firstMatch] || null;
}
get providerButtonComponent() {
const { providerName } = this;
return PROVIDER_WITH_LOGO.includes(providerName) ? `auth-button-${providerName.toLowerCase()}` : null;
} }
} }

View File

@ -54,12 +54,8 @@
id="auth-submit" id="auth-submit"
> >
{{#if this.isOIDC}} {{#if this.isOIDC}}
{{#if this.role.providerButtonComponent}}
{{component this.role.providerButtonComponent}}
{{else}}
Sign in with Sign in with
{{or this.role.providerName "OIDC Provider"}} {{or this.role.providerName "OIDC Provider"}}
{{/if}}
{{else}} {{else}}
Sign In Sign In
{{/if}} {{/if}}

View File

@ -116,6 +116,15 @@
@onSuccess={{action "onMfaSuccess"}} @onSuccess={{action "onMfaSuccess"}}
@onError={{fn (mut this.mfaErrors)}} @onError={{fn (mut this.mfaErrors)}}
/> />
{{else}}
<AuthForm
@wrappedToken={{this.wrappedToken}}
@cluster={{this.model}}
@namespace={{this.namespaceQueryParam}}
@redirectTo={{this.redirectTo}}
@selectedAuth={{this.authMethod}}
@onSuccess={{action "onAuthResponse"}}
/>
{{/if}} {{/if}}
</Page.content> </Page.content>
<Page.footer> <Page.footer>