|
|
@ -1,9 +1,9 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use yii\web\Controller; |
|
|
|
use app\models\LoginForm; |
|
|
|
use app\models\LoginForm; |
|
|
|
use app\models\User; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SiteController extends \yii\web\Controller |
|
|
|
class SiteController extends Controller |
|
|
|
{ |
|
|
|
{ |
|
|
|
public function actionIndex() |
|
|
|
public function actionIndex() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -13,15 +13,13 @@ class SiteController extends \yii\web\Controller |
|
|
|
public function actionLogin() |
|
|
|
public function actionLogin() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$model = new LoginForm(); |
|
|
|
$model = new LoginForm(); |
|
|
|
if (isset($_POST[$model->formName()])) { |
|
|
|
if ($this->populate($_POST, $model) && $model->login()) { |
|
|
|
$model->attributes = $_POST[$model->formName()]; |
|
|
|
Yii::$app->getResponse()->redirect(array('site/index')); |
|
|
|
if ($model->login()) { |
|
|
|
} else { |
|
|
|
Yii::$app->getResponse()->redirect(array('site/index')); |
|
|
|
echo $this->render('login', array( |
|
|
|
} |
|
|
|
'model' => $model, |
|
|
|
|
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
echo $this->render('login', array( |
|
|
|
|
|
|
|
'model' => $model, |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function actionLogout() |
|
|
|
public function actionLogout() |
|
|
|