-
Notifications
You must be signed in to change notification settings - Fork 0
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
bug/WP-287: Remove login url redirect to profile data #904
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #904 +/- ##
==========================================
- Coverage 63.41% 63.41% -0.01%
==========================================
Files 432 432
Lines 12393 12392 -1
Branches 2581 2581
==========================================
- Hits 7859 7858 -1
Misses 4324 4324
Partials 210 210
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
LGTM, working well!
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.
Tested on dev.cep( the branch is deployed there right now).
No longer see the redirect on the specific repro.
I think we need more analysis on allowing only use of certain defined routes as part of 'next' parameter. How did a non-route-page like profile
end up on next?I haven't checked the details, but will look into it 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.
This fixes this specific issue 👍
I think a good long term solution to avoid similar cases would be to change this:
redirect = getattr(settings, 'LOGIN_REDIRECT_URL', '/')
if 'next' in request.session:
redirect += '?next=' + request.session.pop('next')
response = HttpResponseRedirect(redirect)
return response
to this:
redirect = getattr(settings, 'LOGIN_REDIRECT_URL', '/')
response = HttpResponseRedirect(redirect)
return response
Tracking task: WP-395 |
* remove extra get profile data call * fix tests
* remove extra get profile data call * fix tests
Overview
Fixes the bug where in certain cases after logging in the user would be redirected to the /api/profile/data path and see a screen with api data text.
Related
Changes
Background
The profile data retrieved is added to the profile state variable. This state is only used in the ManageAccount components and ManageAccount.jsx already has a
GET_PROFILE_DATA
action being dispatched. So the data is available in that component and removing the action from the AppRouter does not have an effect here.Previously, the
GET_PROFILE_DATA
was added in the AppRouter.jsx as part of this PR which was using the profile state to retrieve user information to display in Allocations tables (see AllocationsTable and AllocationsTeamViewModal).In a later PR the usage of profile was removed from the Allocations components (see AllocationsTable and AllocationsTeamViewModal) However, that added
GET_PROFILE_DATA
action was not removed. Since the profile information is not being used in the Allocations components, the additional action being dispatched in AppRouter should be safe to removeTesting
For reference, this was the flow before the fix:
Screen.Recording.2023-11-17.at.4.21.21.PM.mov
UI
Notes