onestop icon indicating copy to clipboard operation
onestop copied to clipboard

Navigating directly to the user dashboard URL causes a redirect

Open YangusKhan opened this issue 3 years ago • 0 comments

Bug Description If you navigate directly to http://localhost/onestop/dashboard and have already signed in previously, the OneStop UI will trigger a redirect instead of showing the dashboard page. This behavior does not happen if you first go to another OneStop page and then click on the "Dashboard" link in the navigation menu.

Platform/Environment Firefox 84, macOS Catalina 10.15.7

Severity Severity: Low Priority: Low

To Reproduce Steps to reproduce the behavior:

  1. Have a running cluster with at least onestop-client and onestop-user pods.
  2. Go to the /onestop home page and click on the Login link in the navigation menu, and go through the login process.
  3. Navigate to /onestop/dashboard directly in your browser's top URL bar.

Expected Result It should wait to load the user dashboard since you have already logged in for the current session.

Actual Result It displays the message "User session expired. Redirecting to the login screen..." and then redirects the user to the login endpoint.

Additional context I believe the proper fix should be in the UserDashboard component, specifically this part:

const dashboardOrRedirect =
    user && user.isAuthenticated ? (
      dashboardElement
    ) : (
      <LoginRedirectComponent
        loginEndpoint={loginEndpoint}
        configIsFetching={configIsFetching}
        user={user}
      />
    )

The above code could add another case incorporating user.isFetching and display a Loading component of some kind until user.isFetching is no longer true.

YangusKhan avatar Mar 02 '21 16:03 YangusKhan