mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Добавлен обработчик для удаления сессии при логауте
This commit is contained in:
@ -3,6 +3,7 @@ namespace api\controllers;
|
||||
|
||||
use api\models\authentication\ForgotPasswordForm;
|
||||
use api\models\authentication\LoginForm;
|
||||
use api\models\authentication\LogoutForm;
|
||||
use api\models\authentication\RecoverPasswordForm;
|
||||
use api\models\authentication\RefreshTokenForm;
|
||||
use common\helpers\Error as E;
|
||||
@ -26,6 +27,11 @@ class AuthenticationController extends Controller {
|
||||
'allow' => true,
|
||||
'roles' => ['?'],
|
||||
],
|
||||
[
|
||||
'actions' => ['logout'],
|
||||
'allow' => true,
|
||||
'roles' => ['@'],
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
@ -34,6 +40,7 @@ class AuthenticationController extends Controller {
|
||||
public function verbs() {
|
||||
return [
|
||||
'login' => ['POST'],
|
||||
'logout' => ['POST'],
|
||||
'forgot-password' => ['POST'],
|
||||
'recover-password' => ['POST'],
|
||||
'refresh-token' => ['POST'],
|
||||
@ -61,6 +68,15 @@ class AuthenticationController extends Controller {
|
||||
], $result->getAsResponse());
|
||||
}
|
||||
|
||||
public function actionLogout() {
|
||||
$form = new LogoutForm();
|
||||
$form->logout();
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function actionForgotPassword() {
|
||||
$model = new ForgotPasswordForm();
|
||||
$model->load(Yii::$app->request->post());
|
||||
|
Reference in New Issue
Block a user