closed admin panel

This commit is contained in:
akosse
2020-01-29 11:26:01 +03:00
parent 75ccbff934
commit aa501900e4
29 changed files with 876 additions and 17 deletions

View File

@ -6,6 +6,7 @@ use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use common\models\LoginForm;
use yii\helpers\Url;
/**
* Site controller
@ -18,20 +19,6 @@ class SiteController extends Controller
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error'],
'allow' => true,
],
[
'actions' => ['logout', 'index'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
@ -76,10 +63,14 @@ class SiteController extends Controller
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
if (\Yii::$app->user->can('secure')) {
return $this->goBack();
} else {
Yii::$app->user->logout();
return $this->redirect(Url::to('/card/user-card'));
}
} else {
$model->password = '';
return $this->render('login', [
'model' => $model,
]);