-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea1f0ab
commit 8b3d5ef
Showing
3 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
symphony/app/Resources/views/sessionTimeoutAlert.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<div class="modal fade" id="modal-session-timeout-alert" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title" id="myModalLabel">{% trans %}Session Timeout Alert{% endtrans %}</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<p id="countdown_message" class="text-center"></p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans %}Close{% endtrans %}</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% block script %} | ||
<script> | ||
$(function(){ | ||
function initCountdown() { | ||
var counter = {{ session_lifetime }}; | ||
var sessionTimeoutAlert = setInterval(function() { | ||
if(counter == 60) { | ||
$('#modal-session-timeout-alert').modal('show'); | ||
} | ||
if(counter >= 0) { | ||
document.getElementById("countdown_message").innerHTML="{% trans %}You will be logged out in{% endtrans %} <b>"+counter+"</b> {% trans %}seconds{% endtrans %}"; | ||
} | ||
if(counter == 0) { | ||
document.getElementById("countdown_message").innerHTML="{% trans %}Your login has expired.{% endtrans %}"; | ||
$.ajax({ | ||
url: '{{ path('logout_route') }}' | ||
}); | ||
} | ||
counter--; | ||
}, 1000); | ||
} | ||
initCountdown(); | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters