-
Notifications
You must be signed in to change notification settings - Fork 10
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
4574 add session check redirection #4636
Conversation
implimented modal in header.html and changed mixin to use session check.
Terraform plan for meta No changes. Your infrastructure matches the configuration.
✅ Plan applied in Deploy to Development and Management Environment #927 |
Terraform plan for dev Plan: 1 to add, 0 to change, 1 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# module.dev.module.cors.null_resource.cors_header must be replaced
-/+ resource "null_resource" "cors_header" {
!~ id = "*******************" -> (known after apply)
!~ triggers = { # forces replacement
!~ "always_run" = "2025-01-24T17:30:29Z" -> (known after apply)
}
}
Plan: 1 to add, 0 to change, 1 to destroy. ✅ Plan applied in Deploy to Development and Management Environment #927 |
tests to handle new test case
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.
Looks good to me, all my comments were random thoughts I had while reviewing and no changes requested. Thanks!
if not hasattr(request, "user"): | ||
raise PermissionDenied(PERMISSION_DENIED_MESSAGE) | ||
if not request.user: | ||
if not hasattr(request, "user") or not request.user: |
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.
Thank you.
self.assertTemplateUsed(response, "home.html") | ||
self.assertTrue(response.context["session_expired"]) |
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.
I think this is going to be a much better experience, the user will now see a nice page instead of the 403. Great work.
@@ -217,7 +218,7 @@ def test_anonymous_raises(self): | |||
|
|||
view = self.ViewStub() | |||
self.assertRaises( | |||
PermissionDenied, view.dispatch, request, report_id="not-logged-in" | |||
SessionExpiredException, view.dispatch, request, report_id="not-logged-in" |
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.
I was worried we didn't have any remaining tests for PermissionDenied... but then realized I forgot to expand the diff. Again, I think giving more specific exceptions between a Permissions problem and a Session Expired is going be nice.
backend/config/context_processors.py
Outdated
def format_time(seconds): | ||
minutes, seconds = divmod(seconds, 60) | ||
return f"{minutes} minutes, {seconds} seconds" |
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.
I didn't see this used anywhere else (I did a cmd+f to verify).
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.
Removed.
Minimum allowed line rate is |
Link to issue #4574
This feature/fix is designed to solve a usability issue that certain users were experiencing as referenced in this ticket
To test this feature, the user should begin an audit submission and continue to the upload SAC step. Wait for the session to expire with your current login and then attempt to upload the file.

Upon submission, with an expired session, the user should be presented with this screen allowing them to log back in or proceed to the home page.
If the user goes back through the login cycle, the callback URL from login.gov should place them back on the upload submission step where their session expired.
I have created two modals, one for session expiration (session-expired-modal) and one for session timeout warning (session-warning-modal). Each modal has a javascript snippet with it to trigger the modal due to the USWDS framework design requiring a or tag attribute and action to trigger the modal. The javascript snippet creates and simulates a click on an tag for the modal. Due to the nature of how we manage sessions and interaction, the warning modal should never trigger, but I have left the code in place in the nav_primary.html template should we wish to use it in the future.
The session expiration flag is set in mixin.py during the auth check, but could be triggered by anything that can pass the trigger to the template context.
NOTE: A quick way to trigger this for testing is to login, reach the upload step, open a new browser window from the site, logout, and then attempt to upload the file. This should trigger the modal.
PR Checklist: Reviewer
make docker-clean; make docker-first-run && docker compose up
; then rundocker compose exec web /bin/bash -c "python manage.py test"
Pre Merge Checklist: Merger
-/+ resource "null_resource" "cors_header"
should be destroying and recreating its self and~ resource "cloudfoundry_app" "clamav_api"
might be updating itssha256
for thefac-file-scanner
andfac-av-${ENV}
by default.main
.