I need to use the API to login. API to send $ _POST [ 'username']
, $ _POST [ 'password']
on actionLogin ()
.
public function actionLogin()
{
if (!Yii::app()->user->isGuest)
$this->redirect($this->createUrl('site/_allorders'));
$model = new LoginForm;
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
if ($model->validate()) {
$this->redirect(Yii::app()->user->returnUrl);
}
}
$this->layout = 'mini';
$this->render('_loginForm', array('model' => $model));
}
method $ model-> validate ()
normally passes, but it is impossible to log in. What is my fault or what is missing?