CakeDC / users

Users Plugin for CakePHP
https://www.cakedc.com
Other
520 stars 296 forks source link

Remember me function not working #992

Closed atlet closed 2 years ago

atlet commented 2 years ago

I crated a new project with CakePHP 4.2 and cakedc/users plugin (9.2). If I login and thick box remember me, cookie is crated but it's not working properly as I get logged out in about an hour (session duration). Any hints where to check what can be wrong? I followed the installation instructions of plugin.

rochamarcelo commented 2 years ago

Hi @atlet I just tested with users 9.2.1 and could not reproduce the issue. Have you check if the cookie CookieAuth is created with a future expires date?

atlet commented 2 years ago

Hi, I think I found the problem. Cookie is setup, but is missing field username, as I don't store any username in table (they are null). I only use email for login (for username). Now I need to find a solution, how to populate this field.

image

atlet commented 2 years ago

Fixed, now it's working great. In users.php was missing this: Auth.Authenticators.Cookie.fields.username' => 'email',

rochamarcelo commented 2 years ago

Updated doc page https://github.com/CakeDC/users/blob/master/Docs/Documentation/Configuration.md#using-the-users-email-to-login

rochamarcelo commented 2 years ago

Thank you @atlet

rochamarcelo commented 2 years ago

Pull request sent #993 . Thank you.