Trigger actions on user logout?

Hi,

Can we take actions on a user logout event?

In one of my apps, I have;

  1. timers that are running assigned to users when they are working on various tasks. Works well, but sometimes users log outing go home and forget to stop their timers.
  2. a timesheet section for clocking on and off. Again works well but users forget to clock off and just log out.

Wondering if anyone know a way of creating actions on an a logout event? Or even hijacking the logout button, so that i can do a getUserAttributes() to check for timers running and if they are have not clocked out and if so, message popup letting them know?

Thanks!

You can just use the following to perform a function before logout is completed. Use it for one of my clients where Login and Logouts are recorded and it works without any issues:

    $('.kn-log-out').on('click', function () {
        console.log(Knack.getUserAttributes().id);
    });

1 Like