Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only logout if the user is logged in #10929

Merged
merged 1 commit into from
May 3, 2024

Conversation

codyrancher
Copy link
Contributor

@codyrancher codyrancher commented May 1, 2024

Summary

This prevents us from redirecting multiple times when visiting the index on login

Fixes #10926

Technical notes summary

There is still a case on the logout page that we need to be able to call logout even if the user hasn't been authenticated yet because the auth pages don't use the authenticated middleware.

This caused issues with the login page in a roundabout way.

  1. On the index page we authenticate the user so we can redirect them to the appropriate page if the user is logged in.
  2. If a steve api fails due to authentication (happens if the user isn't logged in when visiting the index page) we immediately log the user out and redirect them to the login page.
  3. Between the index page and steve api we would redirect multiple times and we now do a full page refresh on logout to shed all of the loaded extensions. This change prevents logging out unless the user is logged in (unless they visit the logout page directly), which reduce the amount of redirecting.

This change will also reduce the unnecessary timeout redirect we would previously see when visiting the index page.

Areas or cases that should be tested

Logging in and logging out

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

@codyrancher codyrancher force-pushed the logout-only-if-logged-in branch 2 times, most recently from 459b371 to f71ed69 Compare May 2, 2024 23:13
This prevents us from redirecting multiple times when visiting the index on login
rancher#10926
@codyrancher codyrancher added this to the v2.9.0 milestone May 3, 2024
@codyrancher codyrancher marked this pull request as ready for review May 3, 2024 15:28
Copy link
Member

@rak-phillip rak-phillip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - tested and confirmed that the issue is resolved.

@codyrancher codyrancher merged commit 1606e6a into rancher:master May 3, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rancher UI reloads on initial load when not logged in
2 participants