-
Notifications
You must be signed in to change notification settings - Fork 437
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
Fixes redirect on login (#6900) #6911
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for care-egov-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you've removed the support for redirect
param completely, the "Session Expired" workflow wouldn't work this way right, since that still relies on the redirect
param on the login page route?
Very likely because of the hardcoded UUID itself. Such an entity does not exist in cypress environments database. |
Hmm, How do we plan on dealing with that? Should we just redirect them to the same page and bring up the login screen? |
You could do the following:
|
The new redirector function doesn't check for a redirect param anymore so, There'll be that to fix as well |
as required clicking on the button signs out and redirects to the page which then loads a login screen since the user is signed out, In the other case that a query param isn't present the url will just be |
Sorry for the oversight before added a check to ensure that the redirect param redirects to a site that has the same origin as the current site, Not using this could have let malformed urls to be able to redirect to any sites they please ,potentially malicious. |
@rithviknishad This new function works with both the redirect param and the direct urls , When an invalid redirect param is provided with a valid base url, The app chooses to discard the param and simply navigate to the valid base url Instead. The session expired redirects to the redirect param if available. It seems like there should be a test for the redirect param as well? |
Didn't this one line change (#6911 (comment)) alone solve the original issue? Was there some other issues? |
I did change the line to that but there had to be the reserved URLs change because of that rest much isn't changed. |
@rithviknishad The tests should work now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- In the test, navigate to a patient page and store the current URL of the page in a variable.
- Log out and then log back in using the specific URL stored in the variable.
the page is going into an infinite loop on the expired session, to replicate the bug do the following steps
|
Can replicate will try to figure it out. |
export default function SessionExpired() {
const { signOut, user } = useAuthContext();
const isAuthenticated = Boolean(user);
const navigate = useNavigate();
const { t } = useTranslation();
useEffect(() => {
Notification.closeAllNotifications();
}, []);
if (isAuthenticated) {
navigate("/");
} The bug seems to be due to the navigate("/") and i cannot understand why we need it? If the session has expired do we not wish to log the user out on the same page and show session expired with a return to login? |
@rithviknishad @nihal467 @Ashesh3 The issue being session expired page navigates to "/" and then since the session has expired it loads the session expired page again anyway which again navigates to "/", If the token is invalid i don't understand the need for checking the IsAuthenthicated and returning a navigate. |
Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions. |
The bug also happens on the live version of care. https://care.ohc.network hence wasn't introduced by this pr. |
Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions. |
Hi, @gigincg, @nihal467, @khavinshankar, @mathew-alex, This pr has been automatically closed because it has not had any recent activity. Thank you for your contributions. Feel free to repopen the pr. |
Proposed Changes
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
Merge Checklist