Fixed: prevent redirect to login page after successful login using browser back button (#51) #85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issues
Closes #51
Short Description and Why It's Useful
In our current app implementation, after a successful login using the launchpad login page, users were experiencing an unintended behavior when attempting to navigate back using the browser's back button. This issue arose because, initially, we were using "window.location.href" to redirect users to the login page, which then resulted in the login page URL being stored in the browser's history.
To address this issue, we have switched to using "window.location.replace" upon successful login. This method replaces the current URL in the browser's history with the app's URL, ensuring that the login page URL is not stored in the history. As a result, when users hit the browser's back button, they are not redirected to the login page again.
We considered an alternative approach of blocking access to the login page if a user is already authenticated. However, this approach was not feasible due to the presence of a query parameter, "isLoggedOut," in the login page URL when the user first accesses the launchpad login. This parameter is initially set to true and, upon successful login, gets stored in the browser history. Consequently, hitting the back button would cause the user to be redirected to the login page with the "isLoggedOut" query parameter set to true, falsely indicating that the user is logged out.
Given these considerations, we have opted to continue with the first approach of using "window.location.replace" to manage the navigation behavior after a successful login and to ensure a smoother user experience.
Screenshots of Visual Changes before/after (If There Are Any)
IMPORTANT NOTICE - Remember to add changelog entry
Contribution and Currently Important Rules Acceptance