Single Login Auth

What I want to achieve is that the web application only supports single login. So if someone login with the same credential from another machine, browser, or tab, then the current session will be disconnected. Only one login is possible for a single credential at any point of time.

Currently I have no idea how it can be done with the auth component in Yii. Any guidance or help is greatly apprecited.


If you use CDbHttpSession, you can add a user_id column to your session table and then override the CDbHttpSession::writeSession() method. Upon user login you can then delete the old session for the Yii::app()->user->id (if there’s any).

hi ,

I’m facing the same issue.


got any example of code or link that i can refer it?

pls advice.

thank you.

hello anyone any suggestion … :unsure: