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
This commit is contained in:
kolaente 2022-11-16 16:37:00 +01:00
parent 98b38af43c
commit 3891d5b876
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 2 additions and 1 deletions

View File

@ -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)
}