@@ -1032,6 +1032,26 @@ <h3 class="no-margin-top" style="padding-bottom: 5px;">
1032
1032
</ div >
1033
1033
<!-- /.dojo-modals-wrapper -->
1034
1034
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 "> ×</ 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
+
1035
1055
<!-- #footer-wrapper -->
1036
1056
< div id ="footer-wrapper ">
1037
1057
{% block footer %}
@@ -1083,6 +1103,27 @@ <h3 class="no-margin-top" style="padding-bottom: 5px;">
1083
1103
function ( ) { $ ( this ) . popover ( 'show' ) ; } , // hover
1084
1104
function ( ) { $ ( this ) . popover ( 'hide' ) ; } // unhover
1085
1105
) ;
1106
+
1107
+ { % if request . user . is_authenticated % }
1108
+ function session_notifcation ( ) {
1109
+ var warningTime = "{{ session_notify_time|default:0|escapejs }}" ; // When the warning will show
1110
+ var currentTime = Math . floor ( Date . now ( ) / 1000 ) ; // Get current timestamp in seconds
1111
+ var timeout = warningTime - currentTime ; // how many seconds until warning needs to show
1112
+
1113
+ setTimeout ( ( ) => {
1114
+ $ ( '#sessionTimeoutModal' ) . modal ( 'show' ) ;
1115
+ } , timeout * 1000 ) ;
1116
+
1117
+ }
1118
+ session_notifcation ( ) ;
1119
+ $ ( '#sessionTimeoutModal' ) . on ( 'show.bs.modal' , function ( event ) {
1120
+ $ ( this ) . attr ( 'aria-hidden' , 'false' ) ;
1121
+ } )
1122
+ $ ( '#sessionTimeoutModal' ) . on ( 'hidden.bs.modal' , function ( event ) {
1123
+ $ ( this ) . attr ( 'aria-hidden' , 'true' ) ;
1124
+ } )
1125
+ { % endif % }
1126
+
1086
1127
{ % if request . user . is_authenticated and not 'DISABLE_ALERT_COUNTER' | setting_enabled % }
1087
1128
function get_alerts ( ) {
1088
1129
$ ( '.dropdown-alerts' ) . html ( '<div class="text-center"><i class="fa-solid fa-spinner fa-spin"></i></div>' ) ;
0 commit comments