Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong condition before trying autologin #17

Closed
vince12 opened this issue Aug 2, 2013 · 0 comments
Closed

Wrong condition before trying autologin #17

vince12 opened this issue Aug 2, 2013 · 0 comments

Comments

@vince12
Copy link

vince12 commented Aug 2, 2013

Hi,

I believe the condition in Module.php l.73 is wrong:
if(isset($cookie['remember_me']) && $cookieLogin == false)

When the user login normally with the form (and check 'Stay logged in'), it first creates a new cookie + serie, and then, on the next page load (on the page redirection after login), the condition is passed and the serie is updated. The condition should not be passed once the user is logged in. The update is useless and should not be done at that moment.

To avoid this and correct this bug, I propose the following condition:
if(isset($cookie['remember_me']) && !$userIsLoggedIn)

With that condition, the autologin will be tried only if the user is not already connected. It is easy to know if the user is logged in or not by calling:
$userIsLoggedIn = $e->getApplication()->getServiceManager()->get('zfcuser_auth_service')->hasIdentity();

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant