Hello everyone!
Maybe its a rather simple problem, but i can not solve it:
The idea is that when user is logged in from one browser, all other website instances must logout him.
As for simple php+mysql, it is rather straight forward: we make a note of session_id in the mysql when user is logged in and then on every request we check their equality (i.e. smth like "select count(*) from … where sessid=$sessid and id=$id" inserted at the index.php once) and if fails, make a logout.
As for Yii, i can insert a check like
$multilogin_check = (Yii::$app->user->identity->sessid === Yii::$app->session->getId()) ? true : false;
if(!$multilogin_check) {$this->actionLogout();}
in every action of every controller, but i believe there is a much simplier solution.
I tried to use beforeAction() and init() functions of my controllers, but both of them are called before User::findIdentity() is called, so i get "trying to access a property of a non-object" for identity->sessid.
Thanks in advance for any ideas!