Fix bug which caused jobseekers to be taken to saved jobs page after … #7197
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.
Why does visiting /jobseekers/edit redirect the user to the saved jobs page after log in?
When the jobseeker is redirected from the registrations controller to the sessions controller and forced to log in
redirected?
returns false, this causes us to setstore_return_location
to(jobseeker_root_path, scope: :jobseeker)
the jobseeker root path being the saved jobs page, hence the issue we are currently seeing.redirected? looks like this:
the reason this works for other paths is because the other controllers inherit from jobseekers base controller. The jobseekers base controller includes
Authenticated
which calls theauthenticate_scope!
method before each action and if it fails goes to the warden controller#jobseeker_forced_login
action. This callsThe forced_login method above sets the redirected_true param which means that
redirected?
is true and the sessions#new action behaves in the standard devise manner.Why does the registrations controller not do this?
Because it inherits directly from the Devise::SessionsController and so does not have hit our
jobseeker_forced_login
method which setsparams_hash = { redirected: true }
Why don't we change the registrations controller to inherit from the jobseekers base controller?
The registrations_controller relies on a number of devise methods currently and there will quite a few changes that need to be made.
The redirect fix needs to be ready for emails to be sent out tomorrow.
We will also be doing away with this part of the code completely in the next 2-3 weeks as we deploy the one login changes so I don't think it is worth a large refactor at this point in time.
Trello card URL
Changes in this PR:
Screenshots of UI changes:
Before
After
Next steps:
Terraform deployment required?
New development configuration to be shared?