orangehill / bootstrap-session-timeout Goto Github PK
View Code? Open in Web Editor NEWSession timeout and keep-alive control with a nice Bootstrap warning dialog.
License: MIT License
Session timeout and keep-alive control with a nice Bootstrap warning dialog.
License: MIT License
When the application is running on mobile, the timeout is not triggered if it is not focused on that tab or if the mobile is closed.
1 Why keepAliveUrl url is loaded in all page refresh ? session is automatically extended after page refresh so i want only run this url if user nor refresh page,
2 why if i setup keepAlive: false and put keepAliveUrl message modal dont have this url. I want dont exdend session automaticly but add possible for button.
H4 doesn't complain with WCAG standards. When I changed it to H2, it looks bigger, but it passes WCAG requirements.
Alternative solution might be to add the aria-level=2 attribute to the header tag.
I am extending session expiry time from back-end and want to reload the redirAfter and warnAfter values for session timeout. Currently, I do not want to reload the page however I have initiated $.sessionTimeout post-session extending and I can see browser cookies are set to new expiry however redirAfter and warnAfter values are still set to old values. How to update these values [redirAfter and warnAfter].
Would you mind registering this as a bower component? I'm happy to put together the needed changes for you if that would help. Thanks!
Hi Currently my settings is:
$.sessionTimeout({
title:'Idle Timeout',
keepAlive:false,
logoutUrl: '../user/logoff.html',
redirUrl: '../user/logoff.html',
warnAfter: 900000,
redirAfter: 60000,
countdownMessage: 'Redirecting in {timer} seconds.',
countdownBar: true
});
I want the modal to appear after 20 mins of idle, then countdown from 60 secs. It doesn't make sense the redirAfter has to be greater.
Hi, first off thank you for this great plugin. It was quick and easy to set up. I have found an issue though. For my redirect url I was hoping to put a query string simply to trigger an alert on the redirect page.
For example:
redirUrl: "alert.php?action=logout"
However if ?action=logout is added to the redirect it does not redirect to the correct page. It appears to always redirect to the logoutUrl: Even if I add it to the logoutUrl it is never added. Not a huge deal but just wanted to see if I'm missing something. Thanks!
The box doesn't seem to pop up when I set the warnAfter valu greater than 75000.
Near line 125:
Need to correct jQuery v10 selector for bootstrap v3.0.0 modal backdrop
change line:
$('div.modal-backdrop').remove();
to:
$('div.modal-backdrop.fade.in').remove();
.isShown dosen't work on Bootstrap4. Update to ._isShown
Regards.
The popup doesn't change the focus to the modal popup, it remains on what ever element you had originally set the focus. I can't figure out if there is some way to actually set the focus to one of buttons in the modal popup.
how can i remove the logoutButton ?
Wish to know if this plugin can works fine without bootstrap. Is there a way in this plugin to invoke another css framework for the modal like materialize css or foundation css
syntax correction needed near line 228
countd.text(secondsLeft + 's');
should be:
countdownE1.text(secondsLeft + 's');
Hi all,
I set the session timeout interval to 5 mins, the warning message will be shown at 3 minutes and the page will be redirecting at 3:30 to maintain the session. (so the session is never expired unless I close the browser)
And I got an issue on mobile when I go to the page, then open another browser tab, visit another web site and stay there for more than 5 minutes (session timeout interval: 5 mins). Then I go back to the browser tab running the page and see that the warning message is still there, the page was not redirected. And the session is expired.
Is it an issue? How can I get the page redirected at 3:30 to maintain the session as usual?
Near line 61, had to change:
opt.countdownMessage.replace(
to:
opt.countdownMessage.toString().replace(
Any chance you might add in time remaining? I'm not sure how it would work under the current setup, but it might be nice!
You could alternatively add a progress bar going from 100% > 0% based on the timout time - warning time.
Thanks for the plugin!
I believe there is not need to add the 's' suffix at the {time} string, because of internationalization.
's' is only valid in Latin based languages (English, French, Spanish, Italian etc), but it's not valid for other languages such as Greek, Arabic, Chinese, Cyrillic languages etc.
A developer can add his own 'seconds' indicator at the countdownMessage (ex. 'Redirecting in {timer}s')
Hello there,
I use the session timeout library with these settings:
$.sessionTimeout({
keepAlive: false,
logoutUrl: '/logout',
redirUrl: '/logout',
warnAfter: 300000,
redirAfter: 330000,
countdownMessage: 'Redirecting in {timer} seconds.'
});
The problem I experience is that after the warning is shown to the user, the modal is closed after mouse move. I expect the modal to stay open until the timer expires or the user click on one of two buttons: Stay Conntected or Logout.
Thanks, Blerim
The timer should stop after onRedir function has finished execution. Effectively when the whole sessionTimeout cycle has finished once.
The problem is, in our application, we show lock screen modal on the same page, and not redirect user to lock screen page. Now, what happens is, the timer keeps running and shows session timeout warning again.
First of all, many thanks to author, this is a great script
I have made some small modification to bootstrap-session-timeout.js script:
(remaining time countdown display [in seconds]; IE11 modal display(not displaing) bug; useractivity event timer reset)
where #counter is a span with id counter inside keep-alive button (or anywhere you like inside modal div) wich will show remaining seconds until logout
optional (for bootstrap modal IE (11) compatibility, remove "fade" class from parent modal div)
finaly, i have changed events that trigger timer reset on user activity
"keyup mouseup scroll touchend touchmove" - removed mousemove and added scroll, so timer will not be reset (especially when modal is launched) on mousemove event
hope this will help for next script release
should be able to set the xhrFields in the argument to ajax function in the keepAlive function
how can we clear session
The following property checked in the mouse move event does not exist:
$('#session-timeout-dialog').data('bs.modal').isShown
The following does exist however:
$('#session-timeout-dialog').data('bs.modal')._isShown
Is this intended?
Hi,
is there a way to reset the timout?..
I do ajax calls that do not refrsh the entire HTML page, so the timeout keep running..
I would like to call a function (ex : jQuery.sessionTimeout.resetTime() ) after my ajax call that start the countdown again
thanks!
Hi,
First, Thanks for your great script.
I was facing a problem where my site was not working after I deployed. I was getting an error resulting in the use of "use strict" and JavaScript "with". The "with" keyword is being used in another JavaScript library. I realized that the "use strict" statement in bootstrap-session-timeout was outside of the IIFE function and thus made "use strict" global. I fixed this issue by modifying the script to put the "use script" statement just inside the function.
Please consider updating your repository, so that your script can play well with other scripts that may still be using deprecated JavaScript code.
I will also suggest to the authors of the other library to remove the "with" statement.
Thanks.
Thanks for this plugin!
I am not sure if I am missing something but I couldn't find a way to call a web service before redirecting to logout.html
Progress bar is tiny, compared to demo
First, I want to thanks you a lot for this script. it is awesome!
I do have an issue or it could be just something that I am missing.
Here is how my site log in works, when a user logs in, I create a session ID using PHP and I store it in a cookies. Then each time a user refresh the site "from any browser's tab" I reset their expiration time by adding 15 more minutes. this basically adds 900 seconds to the idle timeout stored in the session.
Now, my question is how will I be able to use this script to make a call to a page that tells me how many seconds are remaining before the session times out?
I have a PHP script that returns the total second left before the server times you out so I want to check that script every 10 seconds or so to get a reading on how much time renaming before timing out or display the warning message.
The reason I would need this is because some users my be idle on one browser's tab but active on another tab. So as long and the user is refreshing the site from any tab I want to keep them alive and I don't want one tab to time them out since they are still working.
thank you for your help
Had to change line 47 from;
opt = $.ext(defaults, options);
to:
opt = $.extend(defaults, options);
Hi,
Thanks for the excellent plugin. Keep alive does not seem to run even though these options were set:
keepAlive: true,
keepAliveInterval: 10000,
Adding a call to keepAlive() in the timeout function solved the problem:
function keepAlive() {
if (!keepAlivePinged) {
// Ping keepalive URL using (if provided) data and type from options
$.ajax({
type: opt.ajaxType,
url: opt.keepAliveUrl,
data: opt.ajaxData
});
keepAlivePinged = true;
setTimeout(function() {
keepAlivePinged = false;
keepAlive(); // <-- added this line
}, opt.keepAliveInterval);
}
}
There is an error found by firebug.
TypeError: $(...).data(...) is undefined
bootstr...eout.js (line 103, col 20)
related statement:
$('#session-timeout-dialog').data('bs.modal').isShown
Maybe add
&& typeof $('#session-timeout-dialog').data('bs.modal') !== 'undefined' ?
Hi! Just a feature suggestion:
Add a callback to control server response to the ajax call. For example, we could check status and display warning "Server is unaivailable" or something like this. Now we just sending requests and don't receive any feedback from the server
Why does the modal ignore the backdrop: 'static' so that you can't dismiss the modal when a user clicks outside of it?
hi! i think it is not ok:
IF:
keepalive pinged on mose actions.
ignoreUserActivity: true
keep alive on every page reload at - So i set keepAlive: false;
startSessionTimer(). (if (opt.keepAlive) {keepAlive();}
Result
Then i click stay connected then server are not pinged. in reality user could click sty connected but not click reload page.
workaround: remove pinging on every page reload or add this two options at button click sty connected.
$('#session-timeout-dialog').on('hide.bs.modal', function() {
// Restart session timer
startSessionTimer();
//this keepAlived on stay connected
if (opt.keepAlive===false) {
keepAlivePinged = false;
keepAlive()
}
});
Call me out if I am wrong, but you mention that this build requires bootstrap.js and bootstrap.css. Where are they located?
Doesn't work when used with a page that has a iframe. (I.E. CKEditor etc).
Hi, just wondering where I could find the bootstrap.css file? It's not in the distribution file.
Thanks
I have requirement to enable bootstrap modal pop up to show warn pop up at 20 minutes and redirect , redirect count down start from 10 mins to 0. I tried changing these values warnAfter: 120000, redirAfter: 60000, but pop up not showing up. Could I please get some guidance on this.
Thanks,
Srini
The user should be allowed to use the Bootstrap window without having to define redirects, but instead define their own behaviour in javascript functions defined in the parameters onWarn
and onRedir
.
Hello,
I wonder if this library has any support for multi-tabbing? I've been using BootStrap Session Timeout and it works wonderfully, but I've come to this issue:
If I have more than one tab open, each tab has its own timeout fired. So, let's say I'm working with 3 tabs, and my timeout is set to 5 minutes. If I'm working with tab#3 and haven't opened tab#1 or tab#2 in 5 minutes, my application logout function is fired, and therefore I lose whatever work I do in tab#3.
I wonder if we have anything right now to deal with that? For example, something to communicate with localStorage timer wise?
Just testing out this plugin, I'd like for the KeepAliveButton to post to the keeAliveUrl.
This way if I have keepAlive set to false, if the user chooses to stay logged in, it will post to the keepAliveUrl and keep the user logged in as well as reset the timer.
My server side sessions expire after XX amount of time, I have the warnAfter set a little before and the redirAfter set a little after.
If a user has mouse movements or keyboard activity, I'd like to send keepalive requests, if the user is idle, I don't want keep alive requests sent. The keepAlive request will reset the server side session timer as well as the one defined by this plugin.
If I'm missing something, please correct me. Otherwise I'd love to see these improvements made.
Please look at this issue http://stackoverflow.com/questions/17818493/mousemove-event-repeating-every-second
If use bootstrap-session-timeout and open task manager on the background, the session will never be ended. The answer recommends to check x
an y
location of mouse pointer and if it's not changed does not extend timeout.
I have things configured to show a timeout progress bar with warnAFter set to 60000 and redirAfter set to 120000 (low values for testing).
The dialog appears correctly and the progress bar starts counting down form 60 seconds but as soon as I move the mouse, the progress bar resets to 120 seconds and starts counting down again.
Not a huge deal since there must be someone there if the mouse moves but wanted to let you know.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.