From 25990660335f3f38c43ede9145b3f3c4719796e1 Mon Sep 17 00:00:00 2001 From: k2maan Date: Tue, 5 Sep 2023 13:00:49 +0530 Subject: [PATCH 1/2] Fixed: SAML redirection error in case of unconfigured OMS (404 for for checkLoginOptions) (#44) --- src/views/Login.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index 3ca21e2..a0360de 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -205,13 +205,20 @@ export default defineComponent({ // run SAML login flow if login options are configured for the OMS await this.fetchLoginOptions() - if (this.loginOption.loginAuthType !== 'BASIC') { - window.location.href = `${this.loginOption.loginAuthUrl}?relaystate=${window.location.origin}/login` // passing launchpad/login URL - } else { - this.toggleOmsInput() + + // checking loginOption.length to know if fetchLoginOptions API returned data + // as toggleOmsInput is called twice without this check, from fetchLoginOptions and + // through setOms (here) again + if (Object.keys(this.loginOption).length) { + if (this.loginOption.loginAuthType !== 'BASIC') { + window.location.href = `${this.loginOption.loginAuthUrl}?relaystate=${window.location.origin}/login` // passing launchpad/login URL + } else { + this.toggleOmsInput() + } } }, async fetchLoginOptions() { + this.loginOption = {} try { const resp = await UserService.checkLoginOptions() if (!hasError(resp)) { From 7f57034a46decde71d92c17a2e2f0e6a0f0680d0 Mon Sep 17 00:00:00 2001 From: k2maan Date: Wed, 13 Sep 2023 13:04:04 +0530 Subject: [PATCH 2/2] Improved: condition checks for handling 404 (#44) --- src/views/Login.vue | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index a0360de..1c347d2 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -209,12 +209,10 @@ export default defineComponent({ // checking loginOption.length to know if fetchLoginOptions API returned data // as toggleOmsInput is called twice without this check, from fetchLoginOptions and // through setOms (here) again - if (Object.keys(this.loginOption).length) { - if (this.loginOption.loginAuthType !== 'BASIC') { - window.location.href = `${this.loginOption.loginAuthUrl}?relaystate=${window.location.origin}/login` // passing launchpad/login URL - } else { - this.toggleOmsInput() - } + if (Object.keys(this.loginOption).length && this.loginOption.loginAuthType !== 'BASIC') { + window.location.href = `${this.loginOption.loginAuthUrl}?relaystate=${window.location.origin}/login` // passing launchpad/login URL + } else { + this.toggleOmsInput() } }, async fetchLoginOptions() { @@ -226,8 +224,6 @@ export default defineComponent({ } } catch (error) { console.error(error) - // Fallback TODO Remove this - this.toggleOmsInput() } }, async login() {