fix: InactivitySessionTimeoutMiddleware
: Check for last_login
(allow Django admin login + access)
#7260
+29
−3
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.
Reapply this PR: The original PR was closed due to inactivity,
Please reconsider and if you do not want to merge it a valid reason why not would be much appreciated.
PR fulfills these requirements
[fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made
ex.fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
s/features)
Note: I do not (yet) understand what should be the
TICKET-ID
and how to decide the commit message with this prefixDEV-XXXX
, therefore I left it empty for now and just added the commit message. (Suggestion: Add documentation for outside collaborators how they can determine this).Change has impacts in these area(s)
(check all that apply)
Not really sure which one to choose.
Describe the reason for change
Allows login into the Django admin "Out-of-the-box", and makes sure no
last_login
comparison is made when never logged in. See also the issue Admin Page - Not letting login #4083What does this fix?
Allow users to login via the Django admin login screen (
/admin/#
)What is the new behavior?
The
InactivitySessionTimeoutMiddleware
won't automatically logout a user whenlast_login
is not set in the user session.What is the current behavior?
The
InactivitySessionTimeoutMiddleware
logs out all users which do not have thelast_login
value set > 0 in the user session.What libraries were added/updated?
N/A
Does this change affect performance?
No
Does this change affect security?
No
What alternative approaches were there?
I suggest to completely remove the
InactivitySessionTimeoutMiddleware
in a future release. Session expiration time can be set out of the box via the SESSION_COOKIE_AGE.If manual extension / adjustion of the session time is required, you can use the .set_expiry() method. (In the
/users/#
view for example).What feature flags were used to cover this change?
N/A
Does this PR introduce a breaking change?
(check only one)
What level of testing was included in the change?
(check all that apply)
Which logical domain(s) does this change affect?
(for bug fixes/features, be as precise as possible. ex. Authentication, Annotation History, Review Stream etc.)
Authentication