From 3891d5b87634c890265477680fafaa04ff06cc3e Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 16 Nov 2022 16:37:00 +0100 Subject: [PATCH] feat: only automatically redirect to provider if the url contains ?redirectToProvider=true and it's the only one Resolves https://github.com/go-vikunja/frontend/issues/90 --- src/stores/auth.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stores/auth.ts b/src/stores/auth.ts index 17f8a1dd7c..62ec7acf2a 100644 --- a/src/stores/auth.ts +++ b/src/stores/auth.ts @@ -23,7 +23,8 @@ function redirectToProviderIfNothingElseIsEnabled() { auth.local.enabled === false && auth.openidConnect.enabled && auth.openidConnect.providers?.length === 1 && - (window.location.pathname.startsWith('/login') || window.location.pathname === '/') // Kinda hacky, but prevents an endless loop. + (window.location.pathname.startsWith('/login') || window.location.pathname === '/') && // Kinda hacky, but prevents an endless loop. + window.location.search.includes('redirectToProvider=true') ) { redirectToProvider(auth.openidConnect.providers[0], auth.openidConnect.redirectUrl) }