Добавлен обработчик для удаления сессии при логауте

This commit is contained in:
ErickSkrauch
2016-07-17 19:38:04 +03:00
parent 2063d7daa0
commit ae3c3b88de
5 changed files with 128 additions and 0 deletions

View 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;
}
}