Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Once user updates any form in content edit page, the preventAutologout() function is triggered then timer will keep looping forever on that editing page.
Proposed resolution
The proposed solution is to add a refresh() function to timer after preventAutologout() finishing its job so that activity is re-set to false and autologout starts to run again.
Remaining tasks
Patch needs to be reviewed.
Comment | File | Size | Author |
---|---|---|---|
#4 | autologout-timer_reset_loop_6.x_4.x-2064719-4.patch | 1.54 KB | johnennew |
#2 | timer_reset_loop-2064719-2.patch | 1001 bytes | torpy |
timer_reset_loop-0.patch | 366 bytes | Xiao Deng | |
Comments
Comment #1
johnennew CreditAttribution: johnennew commentedHi Xiao Deng,
Thanks for the patch submission. I'm trying to understand the problem. Are you talking about the JavaScript timer?
Comment #2
torpy CreditAttribution: torpy commentedHi ceng,
The problem is that if you're on a content edit page (for example) and enter something on the form, the 'formUpdated' event fires, which in turn triggers 'preventAutologout'. This goes off and sets the 'activity' variable to TRUE.
What this does is prevent an automated logout if you're editing a form (which I think is a brilliant feature! :). However, this flag is never reset back to FALSE. So basically, if you idle on that page, you will never be logged out.
Xiao's patch above tried to resolve this but caused multiple timers to be created. My patch (attached) attempts to set a timeout of 1 minute (which is the minimum autologout can be set for) after which activity is set back to FALSE.
Comment #3
johnennew CreditAttribution: johnennew commentedOK, got it - thanks @torpy. Have committed patch in #2 to 7.x-4.x - setting to 6.x-4.x for the backport. (Feel free to supply a patch or I'll do one when I get a moment.)
Comment #4
johnennew CreditAttribution: johnennew commentedPatch for 6.x-4.x branch attached
Comment #5
johnennew CreditAttribution: johnennew commentedCommitted this patch to 6.x-4.x