From 7ccf8bcdc85247041113d3bf92ad05d975a7d008 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 20 Apr 2021 20:32:47 +0200 Subject: [PATCH] web/admin: only pre-select items when creating a new object Signed-off-by: Jens Langhammer --- web/src/pages/sources/oauth/OAuthSourceForm.ts | 4 ++-- web/src/pages/sources/saml/SAMLSourceForm.ts | 6 +++--- .../authenticator_static/AuthenticatorStaticStageForm.ts | 2 +- .../stages/authenticator_totp/AuthenticatorTOTPStageForm.ts | 2 +- web/src/pages/stages/password/PasswordStageForm.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/src/pages/sources/oauth/OAuthSourceForm.ts b/web/src/pages/sources/oauth/OAuthSourceForm.ts index ff3201a793..6b898e4d97 100644 --- a/web/src/pages/sources/oauth/OAuthSourceForm.ts +++ b/web/src/pages/sources/oauth/OAuthSourceForm.ts @@ -196,7 +196,7 @@ export class OAuthSourceForm extends Form { }).then(flows => { return flows.results.map(flow => { let selected = this.source?.authenticationFlow === flow.pk; - if (!this.source?.authenticationFlow && flow.slug === "default-source-authentication") { + if (!this.source?.pk && !this.source?.authenticationFlow && flow.slug === "default-source-authentication") { selected = true; } return html``; @@ -216,7 +216,7 @@ export class OAuthSourceForm extends Form { }).then(flows => { return flows.results.map(flow => { let selected = this.source?.enrollmentFlow === flow.pk; - if (!this.source?.enrollmentFlow && flow.slug === "default-source-enrollment") { + if (!this.source?.pk && !this.source?.enrollmentFlow && flow.slug === "default-source-enrollment") { selected = true; } return html``; diff --git a/web/src/pages/sources/saml/SAMLSourceForm.ts b/web/src/pages/sources/saml/SAMLSourceForm.ts index 87de1617e1..2fc1dfc285 100644 --- a/web/src/pages/sources/saml/SAMLSourceForm.ts +++ b/web/src/pages/sources/saml/SAMLSourceForm.ts @@ -227,7 +227,7 @@ export class SAMLSourceForm extends Form { }).then(flows => { return flows.results.map(flow => { let selected = this.source?.preAuthenticationFlow === flow.pk; - if (!this.source?.preAuthenticationFlow && flow.slug === "default-source-pre-authentication") { + if (!this.source?.pk && !this.source?.preAuthenticationFlow && flow.slug === "default-source-pre-authentication") { selected = true; } return html``; @@ -247,7 +247,7 @@ export class SAMLSourceForm extends Form { }).then(flows => { return flows.results.map(flow => { let selected = this.source?.authenticationFlow === flow.pk; - if (!this.source?.authenticationFlow && flow.slug === "default-source-authentication") { + if (!this.source?.pk && !this.source?.authenticationFlow && flow.slug === "default-source-authentication") { selected = true; } return html``; @@ -267,7 +267,7 @@ export class SAMLSourceForm extends Form { }).then(flows => { return flows.results.map(flow => { let selected = this.source?.enrollmentFlow === flow.pk; - if (!this.source?.enrollmentFlow && flow.slug === "default-source-enrollment") { + if (!this.source?.pk && !this.source?.enrollmentFlow && flow.slug === "default-source-enrollment") { selected = true; } return html``; diff --git a/web/src/pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts b/web/src/pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts index 1ee32055fd..b160d50561 100644 --- a/web/src/pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts +++ b/web/src/pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts @@ -78,7 +78,7 @@ export class AuthenticatorStaticStageForm extends Form }).then(flows => { return flows.results.map(flow => { let selected = this.stage?.configureFlow === flow.pk; - if (!this.stage?.configureFlow && flow.slug === "default-otp-time-configure") { + if (!this.stage?.pk && !this.stage?.configureFlow && flow.slug === "default-otp-time-configure") { selected = true; } return html``; diff --git a/web/src/pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts b/web/src/pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts index 4ca56ad864..51b14400fc 100644 --- a/web/src/pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts +++ b/web/src/pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts @@ -84,7 +84,7 @@ export class AuthenticatorTOTPStageForm extends Form { }).then(flows => { return flows.results.map(flow => { let selected = this.stage?.configureFlow === flow.pk; - if (!this.stage?.configureFlow && flow.slug === "default-otp-time-configure") { + if (!this.stage?.pk && !this.stage?.configureFlow && flow.slug === "default-otp-time-configure") { selected = true; } return html``; diff --git a/web/src/pages/stages/password/PasswordStageForm.ts b/web/src/pages/stages/password/PasswordStageForm.ts index 38de2f9490..149effb440 100644 --- a/web/src/pages/stages/password/PasswordStageForm.ts +++ b/web/src/pages/stages/password/PasswordStageForm.ts @@ -94,7 +94,7 @@ export class PasswordStageForm extends Form { }).then(flows => { return flows.results.map(flow => { let selected = this.stage?.configureFlow === flow.pk; - if (!this.stage?.configureFlow && flow.slug === "default-password-change") { + if (!this.stage?.pk && !this.stage?.configureFlow && flow.slug === "default-password-change") { selected = true; } return html``;