Ad
Logout On Automatic Expiration Of Session In Laravel
How can I call log out on the automatic expiration of session in Laravel? I already added this in session.php
'lifetime' => 10,
'expire_on_close' => true,
Ad
Answer
Handle it using JS - (working fine in my project)
/*
* this script is for manage the logout of timeout
* if user is inactive for 15 min
* he will be logout :
*
* */
var logout = 'Are you sure to logout?';
var timeout;
var url = ''; // route path;
document.onmousemove = function(){
clearTimeout(timeout);
timeout = setTimeout(function () {
var confirmstatus = confirm( logout );
if(confirmstatus === true) {
var redirect = $.ajax({
cache: false,
url: url,
type: "GET",
headers: {
'X-CSRF-TOKEN': window.project.csrfToken
},
contentType: false,
processData: false,
success: function (response) {
window.location.href = url;
}
});
}
}, 60000*15);
};
</script>
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad