fix(ui):ArgoCD Login Link Displays Layouts Before Login Page#25463
fix(ui):ArgoCD Login Link Displays Layouts Before Login Page#25463aali309 wants to merge 7 commits intoargoproj:masterfrom
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
ui/src/app/shared/components/protected-route/protected-route.tsx
Outdated
Show resolved
Hide resolved
ui/src/app/shared/components/protected-route/protected-route.tsx
Outdated
Show resolved
Hide resolved
0495ce5 to
e0aae7c
Compare
ui/src/app/shared/components/protected-route/protected-route.tsx
Outdated
Show resolved
Hide resolved
ui/src/app/app.tsx
Outdated
| if (iss && iss !== 'argocd') { | ||
| return ((authSettings.dexConfig && authSettings.dexConfig.connectors) || []).length > 0 || authSettings.oidcConfig; | ||
| // Combine both async calls into one Promise.all for better performance | ||
| const [userInfo, authSettings] = await Promise.all([services.users.get(), services.authService.settings()]); |
There was a problem hiding this comment.
This change is not part of the actual fix, right (on its own that is)? Also there seems to be duplicate code here and in the new protected-route component, it can apply the same logic?
There was a problem hiding this comment.
reverted this and extracted the code into shared function that both files can reuse.
642c3c4 to
fd880f6
Compare
7452ce5 to
05da4de
Compare
| // Check SSO configuration if user is not logged in | ||
| const hasSSO = isSSOConfigured(userInfo, authSettings); | ||
|
|
||
| return {loggedIn: false, isSSO: hasSSO}; |
There was a problem hiding this comment.
If SSO is not configured, then should we be returning loggedIn as false?
There was a problem hiding this comment.
Yes. If they’re not logged in, we always use loggedIn: false. isSSO only picks SSO redirect vs the normal login page. It doesn’t mean they’re logged in. So when SSO isn’t set up, we still return loggedIn: false and isSSO: false.
| appContext.navigation.goto('.', {sso_error: null}); | ||
|
|
||
| await services.users.login(username, password); | ||
| setLoginInProgress(false); |
There was a problem hiding this comment.
Should we ensure setLogInProgress is set to false below, in a finally ?
| } catch (e) { | ||
| setLoginError(e.response.body.error); | ||
|
|
||
| window.location.replace(basehref + redirectPath); |
There was a problem hiding this comment.
Could you use appContext.navigation.goto here instead?
Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com>
Signed-off-by: Atif Ali <atali@redhat.com>
…uses Signed-off-by: Atif Ali <atali@redhat.com>
| return ( | ||
| <DataLoader input={cacheKey} load={checkAuthState}> | ||
| {({loggedIn, isSSO}) => { | ||
| if (loggedIn) { |
There was a problem hiding this comment.
Regarding my comment at line 31, or maybe the change should be here instead.
If SSO is not enabled, then loggedIn is false, so we always present the login page. Should it be instead, if and only if SSO is enabled, then we prompt to log in if loggedIn is false?
There was a problem hiding this comment.
I think this would be wrong? Because even if SSO is not enabled, users still must see /login i.e (local accounts).
The flow currently is:
When loggedIn is false, we always send users to a login flow. isSSO only chooses how: if SSO is set up for the redirect path we use /auth/login, otherwise we Redirect to /login. Local-only installs still need the /login page, so we can’t gate “prompt for login” on SSO being enabled only.
There was a problem hiding this comment.
i.e we should not be skipping login because SSO is not enabled.
When the ArgoCD login link is launched, the initial view does not directly display the login page. Instead, it shows various layouts, ArgoCD versions, and tabs before finally loading the login page. This behaviour may lead to confusion for users expecting an immediate login prompt.
Checklist: