FREE CODE!


AUTOMATED LOGOUT

 

Automatically logout idle users after X minutes for additional system security.
Make sure to update the values of the variables applicationID, and restAPIkey with those from your own app. 

KnackInitAsync = function ($, callback) {
    
    // REQUIRED: Explicitly include jQuery
    window.$ = $;
    // Load Soluntech Library
    LazyLoad.js(['https://s3.amazonaws.com/soluntech-www/KnackJS/soluntech-knack-lib-min.js'], function () {
        var soluntech = new Soluntech({
            applicationID: 'XXXXXX',
            restAPIkey: 'XXXXXX',
            environment: 'development'
        });

        soluntech.addTask('Automatic Logout', 'knack-page-render.scene_96', function () {
            var self = this;
            self.startIdleTimer({
                timeout: 5000,  // 5 seconds
                userGoesIdleCallback: function () {
                    self.updateIdleTimer(); // Stop and destroy is default action
                    self.logout();
                }
            });
        });
        callback();
    });
};

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.