Skip to content

Commit 781ae01

Browse files
authored
Revert "Session timeout notification (#12093)" (#12186)
This reverts commit 4d2cafc.
1 parent c9d0896 commit 781ae01

File tree

3 files changed

+0
-54
lines changed

3 files changed

+0
-54
lines changed

dojo/context_processors.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,3 @@ def bind_announcement(request):
5757
).get(user=request.user)
5858
return {"announcement": user_announcement.announcement}
5959
return {}
60-
61-
62-
def session_expiry_notification(request):
63-
import time
64-
65-
try:
66-
if request.user.is_authenticated:
67-
last_activity = request.session.get("_last_activity", time.time())
68-
expiry_time = last_activity + settings.SESSION_COOKIE_AGE # When the session will expire
69-
warning_time = settings.SESSION_EXPIRE_WARNING # Show warning X seconds before expiry
70-
notify_time = expiry_time - warning_time
71-
else:
72-
notify_time = None
73-
except Exception:
74-
return {}
75-
else:
76-
return {
77-
"session_notify_time": notify_time,
78-
}

dojo/settings/settings.dist.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
DD_SECURE_HSTS_SECONDS=(int, 31536000), # One year expiration
4444
DD_SESSION_COOKIE_SECURE=(bool, False),
4545
DD_SESSION_EXPIRE_AT_BROWSER_CLOSE=(bool, False),
46-
DD_SESSION_EXPIRE_WARNING=(int, 300), # warning 5 mins before expiration
4746
DD_SESSION_COOKIE_AGE=(int, 1209600), # 14 days
4847
DD_CSRF_COOKIE_SECURE=(bool, False),
4948
DD_CSRF_TRUSTED_ORIGINS=(list, []),
@@ -760,7 +759,6 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param
760759
SECURE_HSTS_INCLUDE_SUBDOMAINS = env("DD_SECURE_HSTS_INCLUDE_SUBDOMAINS")
761760

762761
SESSION_EXPIRE_AT_BROWSER_CLOSE = env("DD_SESSION_EXPIRE_AT_BROWSER_CLOSE")
763-
SESSION_EXPIRE_WARNING = env("DD_SESSION_EXPIRE_WARNING")
764762
SESSION_COOKIE_AGE = env("DD_SESSION_COOKIE_AGE")
765763

766764
# ------------------------------------------------------------------------------
@@ -863,7 +861,6 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param
863861
"dojo.context_processors.bind_system_settings",
864862
"dojo.context_processors.bind_alert_count",
865863
"dojo.context_processors.bind_announcement",
866-
"dojo.context_processors.session_expiry_notification",
867864
],
868865
},
869866
},

dojo/templates/base.html

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,26 +1032,6 @@ <h3 class="no-margin-top" style="padding-bottom: 5px;">
10321032
</div>
10331033
<!-- /.dojo-modals-wrapper -->
10341034

1035-
<!-- Session Timeout Modal -->
1036-
<div class="modal fade" id="sessionTimeoutModal" tabindex="-1" role="dialog" aria-labelledby="sessionModalLabel" aria-hidden="true">
1037-
<div class="modal-dialog" role="document">
1038-
<div class="modal-content">
1039-
<div class="modal-header">
1040-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
1041-
<span aria-hidden="true">&times;</span>
1042-
</button>
1043-
<h4 class="modal-title" id="sessionModalLabel">Session Expiring Soon</h4>
1044-
</div>
1045-
<div class="modal-body">
1046-
Your session is about to expire due to inactivity.
1047-
</div>
1048-
<div class="modal-footer">
1049-
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
1050-
</div>
1051-
</div>
1052-
</div>
1053-
</div>
1054-
10551035
<!-- #footer-wrapper -->
10561036
<div id="footer-wrapper">
10571037
{% block footer %}
@@ -1103,18 +1083,6 @@ <h4 class="modal-title" id="sessionModalLabel">Session Expiring Soon</h4>
11031083
function() { $(this).popover('show'); }, // hover
11041084
function() { $(this).popover('hide'); } // unhover
11051085
);
1106-
1107-
function session_notifcation() {
1108-
var warningTime = "{{ session_notify_time|default:0|escapejs }}"; // When the warning will show
1109-
var currentTime = Math.floor(Date.now() / 1000); // Get current timestamp in seconds
1110-
var timeout = warningTime - currentTime; // how many seconds until warning needs to show
1111-
1112-
setTimeout(() => {
1113-
$("#sessionTimeoutModal").modal("show");
1114-
}, timeout * 1000);
1115-
}
1116-
session_notifcation();
1117-
11181086
{% if request.user.is_authenticated and not 'DISABLE_ALERT_COUNTER'|setting_enabled %}
11191087
function get_alerts() {
11201088
$('.dropdown-alerts').html('<div class="text-center"><i class="fa-solid fa-spinner fa-spin"></i></div>');

0 commit comments

Comments
 (0)