How to disable submit button if session expired?

Pressing the button "Stay Connected" will prolongue the login session? I'm asking to understand if there is a security issue to have users prolongue their login session as long they want..

What I'm thinking with this Bootstrap script is to notify/alert the user if the session is about to end in order to submit the form; if no action is taken, then logout the user and display a message. But if the user can go on and on with the session, I think it could be a security risk.
 
"Stay connected" button actually doesn't extend the Joomla session if you don't hooks some actions behind it. It just resets the script countdown time.

If you want, you can remove / disable this button.
 
It's not maybe the most "correct" way to do it, but it works well if you only want the plugin to be loaded on your Fabrik form template.

Copy the .js file to your form template's folder. Then add somewhere in top of the default.php file, something like:

JavaScript:
?>
...
<script src="<?php echo $uri->root() ?>components/com_fabrik/views/form/tmpl/your-template-name/bootstrap-session-timeout.min.js"></script>

jQuery(document).ready(function() {

    jQuery.sessionTimeout({
        logoutButton: 'Leave Record',
        keepAliveButton: 'Continue Editing',
        warnAfter: 900000, // 15 minutes
        redirAfter: 1200000, // 20 minutes,
        countdownBar: true,
        countdownSmart: true,
    });
});
...
<?php

The "document.ready" part is optional if you want to change some of the default settings. You can add or remove parameters here according to your need.
 
Last edited:
We really should be moving away from jQuery. It is not longer used in joomla and won't be used in F5. Best to use vanilla js with anything you are doing now so you won't need to refactor later.
 
I generally agree with your statement, although I personally see myself still benefiting jQuery probably at least for a few years from now as I use a few excellent plugins relying on jQuery and also my own custom jQuery plugins are still running strong.
We really should be moving away from jQuery. It is not longer used in joomla and won't be used in F5. Best to use vanilla js with anything you are doing now so you won't need to refactor later.
 
It's not maybe the most "correct" way to do it, but it works well if you only want the plugin to be loaded on your Fabrik form template.

Copy the .js file to your form template's folder. Then add somewhere in top of the default.php file, something like:

JavaScript:
?>
...
<script src="<?php echo $uri->root() ?>components/com_fabrik/views/form/tmpl/your-template-name/bootstrap-session-timeout.min.js"></script>

jQuery(document).ready(function() {

    jQuery.sessionTimeout({
        logoutButton: 'Leave Record',
        keepAliveButton: 'Continue Editing',
        warnAfter: 900000, // 15 minutes
        redirAfter: 1200000, // 20 minutes,
        countdownBar: true,
        countdownSmart: true,
    });
});
...
<?php

The "document.ready" part is optional if you want to change some of the default settings. You can add or remove parameters here according to your need.
Thanks
 
Back
Top