mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Добавлен обработчик для удаления сессии при логауте
This commit is contained in:
20
api/models/authentication/LogoutForm.php
Normal file
20
api/models/authentication/LogoutForm.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace api\models\authentication;
|
||||
|
||||
use api\models\base\ApiForm;
|
||||
|
||||
class LogoutForm extends ApiForm {
|
||||
|
||||
public function logout() : bool {
|
||||
$component = \Yii::$app->user;
|
||||
$session = $component->getActiveSession();
|
||||
if ($session === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$session->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user