We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    I'm using Revo 2.2.15 and the Login snippet with a checkbox 'rememberme'. I would like the following to happen:

    A) user logs in and selects the rememberme checkbox: I want the user to stay logged in for as long as the session_cookie_lifetime is set (this is 7 days for me).

    B) user logs in and deselects the rememberme checkbox: I want the user to be logged out whenever he closes the browser.

    But it seems like the session_cookie_lifetime is always used, no matter if the checkbox is selected or not, and no matter if it's included in the login form or not. What am I doing wrong? My checkbox looks like this:

    <input class="loginRememberme" type="checkbox" name="rememberme" id="rememberme" value="1" checked="checked" />
    <label for="rememberme">Remember me </label>


    EDIT: I gathered from this post: https://forums.modx.com/index.php?topic=58251.0 that the session_cookie_lifetime setting would only be used if the remember me checkbox was checked:

    Without the rememberme option, the default is when the current browser session is ended. Otherwise, it uses the lifetime provided to set the session cookie expiration time.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      As far as the logout on browser close goes, that depends on the user's browser settings. If I have my browser set to clear cookies when I close my browser, it doesn't matter if I use the remember-me check box or not, the cookie is destroyed when I close my browser, and thus I'm never remembered.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 19328
        • 433 Posts
        Yeah I know, but I tested in a 'fresh' browser without custom settings like that (Safari). I understand it's up to the user's browser settings but my client wants it to work like this for people who don't have special settings regarding cookies (for privacy reasons, like when they're on a public computer in the library or something)...

        Shouldn't unchecking the remember-me checkbox destroy the cookie instead of the session_cookie_lifetime still being used? If not, what is the use of the remember me checkbox?
          • 22303 MODX Staff
          • 10,725 Posts
          The session cookie should be destroyed when the browser session is closed if rememberme is not passed or has an empty value (e.g. 0).