Yii2: exit the browser after changing the user password

I want to bring the user out of the browser when he changes his current password. I put the code in my controller function after saving the new passowrd to the database:

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

It works only for the browser, from where I changed the password. but not for all browsers. I checked the session variable $session['id']whether it exists or not. I see that it exists in another browser even after I change my password from another browser.

+4
source share
2 answers

, , , session_id. , :

// The hard part: find out what $old_session_id is
    $session = Yii::$app->session;
    unset($session['old_id']);
    unset($session['timestamp']);
    $session->destroy();


// Now proceed to create a new session for the new login

, , , , ( ).

- , "" . ; - , , XXX , . , .

, , . .

+1
0

Source: https://habr.com/ru/post/1608633/


All Articles