|
|
@ -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,16 +13,14 @@ 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()]; |
|
|
|
|
|
|
|
if ($model->login()) { |
|
|
|
|
|
|
|
Yii::$app->getResponse()->redirect(array('site/index')); |
|
|
|
Yii::$app->getResponse()->redirect(array('site/index')); |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
echo $this->render('login', array( |
|
|
|
echo $this->render('login', array( |
|
|
|
'model' => $model, |
|
|
|
'model' => $model, |
|
|
|
)); |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function actionLogout() |
|
|
|
public function actionLogout() |
|
|
|
{ |
|
|
|
{ |
|
|
|