Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Remember_me is always on
  • I have activated the remember me functionality and I am using simple auth:

    'remember_me' => array(
    /**
    * Whether or not remember me functionality is enabled
    */
    'enabled' => true,

    /**
    * Name of the cookie used to record this functionality
    */
    'cookie_name' => 'rememberme',

    /**
    * Remember me expiration (default: 31 days)
    */
    'expiration' => 86400 * 31 * 3,
    ),

    On login screen, I have a checkbox to activate remember me or not.

    // does the user want to be remembered?
    if (\Input::post('rememberme', false)) { // create the remember-me cookie
    \Auth::remember_me();
    }
    else { // delete the remember-me cookie if present
    \Auth::dont_remember_me();
    }

    And the remember me function works.
    On logout, I do:

    // Logout
    \Auth::dont_remember_me();
    \Auth::logout();

    The problem:

    - I log in into my account without rm (no rm-cookie is set)
    - I click on any page of my site (rm cookie is set). Why?
    - When I close the browser and reopen it, I am logged in. Why?
  • HarroHarro
    Accepted Answer
    remember-me is implemented through a session instance. And enabling a session instance will always create the cookie, regardless of it's content.

    The reason why you are still logged in when you re-open your browser is probably because your session hasn't expired. This is not related to the remember-me function.

    The default is expiry after 2 hours of inactivity. If you want auto-expiry of your session when you close the browser, you need to change your session configuration file, and set 'expire_on_close' to 'true' (default is false).

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion