Set Current.session if signed-in in unauthenticated access #53220
+5
−2
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.
Motivation / Background
This is related to the authentication generator.
Currently, if you call
allow_unauthenticated_access
in a controller,Current.session
won't be set. This can result in rendered views making the user appear to be signed out if they are already signed in.Detail
This updates
allow_unauthenticated_access
to set abefore_action
ofresume_session
to allow the user to still be signed in for requests that do not require authentication.Additional information
Also included in this PR are two quick fixup commits:
Session
model needlessly if the cookie isn't set.SessionsController#destroy
should redirect withsee_other
to match existing scaffolding controller destroy actions.Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]