Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Remember me doesn't work
  • Hi guys,

    From the past i never experienced problem with the remember me fonctionnality, but here, i can't get it to work.

    I used Fuel v1.7, the last. So when using remember me, i can see the cookie, but he doesn't do his job. I read the perform_check function from the simpleauth class and var_dumped the cookie session. The result : 

    ["keys":protected]=>
      array(6) {
        ["session_id"]=>
        string(32) "540ba19ebfd526b05204d9cca0e0fa97"
        ["ip_hash"]=>
        string(32) "4869e012aa045958bdf5c461577cf02d"
        ["user_agent"]=>
        string(105) "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
        ["created"]=>
        int(1414572119)
        ["updated"]=>
        int(1414572126)
        ["payload"]=>
        string(0) ""
      }

    So that's why it doesn't work, the user_id key used to perform the force_login isn't there. Any solution ?

    Thanks
  • If you enable "remember_me" in the config, the session will be created.

    It will not have any content unless you call Auth::remember_me(), which actually stores the current users id in the session.

    So perhaps you have a logic error in your code?
  • Yeah, remember_me is enabled in simpleauth config file and i set the cookie on login, there is no logic error. The problem is that the user_id key isn't set in the 'rmcookie' keys / values. (Btw, i changed the cookie name for 'rm')
  • It is set here https://github.com/fuel/auth/blob/1.8/develop/classes/auth/login/driver.php#L253 when the remember_me() method is called. If that is called, and you have a logged-in user, that should work.

    Just double checked here, and my apps don't have any issue with this feature.

    Perhaps debug the method to check if it's really called, and if the session value is correctly set?
  • That's what I did when I posted the session dump, the code was placed in the perform_check method. But it seem to work now nevertheless I did nothing. I will keep an eye on it and come back if the issue come back.
  • Excuse me, I have explored all the auth folder for php code that contain declaration of remember_me() and have not found it.

    Is it exsists?
  • It's in both the Simpleauth and Ormauth Login drivers.
  • Harro Verton, excuse me. Please.
    Can you show me the filepath for that file, where is it declared? I searched recursive with Midnight Commander, I looked every file in Simpleauth package and I have not found it...


  • Oh, sorry. I am stupid stupid idiot :(
    I use someone of very old version of framework source... Going ot update now...
  • lol, that might explain it. ;-)

    If you update, it's best to go directly to 1.8/develop, it's the most stable version (and about to become the 1.7.3 release).

Howdy, Stranger!

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

In this Discussion