Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2: logout from all browser after a user change password

I want to logged out a user from all browser when he change his current password. I have put the code into my controller function after saving the new passowrd into database:

$session = Yii::$app->session;
unset($session['id']);
unset($session['timestamp']);
$session->destroy();

It works only for the browser from where I changed my password. but not for all browser. I have checked the session variable - $session['id'] is exists or not. I can see it exists in other browser even after I change my password from different browser.

like image 348
Md. Shamvil Hossain Avatar asked Sep 23 '15 08:09

Md. Shamvil Hossain


1 Answers

Related issue @github/yii2:

User stays authorized despite auth key is changed #9718: https://github.com/yiisoft/yii2/issues/9718

like image 178
Fory Avatar answered Nov 04 '22 18:11

Fory