FranMercaes
FranMercaes

Reputation: 151

Zend Framework 2 destroy another user session

I need to find a way to destroy another user session for my login module. What I want is prevent multiple login's with the same credentials. Any idea?

Thanks in advance.

Upvotes: 1

Views: 531

Answers (2)

Syed Azhar Abbas
Syed Azhar Abbas

Reputation: 26

Zend_Session::setId($sess_id);
Zend_Auth::getInstance()->clearIdentity();
Zend_Session::destroy();

where $sess_id is session id of that user.

Upvotes: 0

Sven
Sven

Reputation: 70933

You should write the session id used when logging in into your database.

Afterwards, when checking whether or not the credentials are valid for a request, check for the saved session id also. If it is not matching, the user is not logged in anymore with this session, e.g. he or someone else did another login with a different session id.

Upvotes: 1

Related Questions