tried to explain to the login process flow.
try to check on this file: main.php
array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
This indicates that there is a login method on the controller SiteController and there is method ‘actionLogin’
and it really try to check on siteController
/**
* Displays the login page
*/
public function actionLogin()
{
$model=new LoginForm;
// if it is ajax validation request
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if(isset($_POST['LoginForm']))
{
$model->attributes=$_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if($model->validate() && $model->login())
$this->redirect(Yii::app()->user->returnUrl);
}
// display the login form
$this->render('login',array('model'=>$model));
}
in the above code, actionLogin will call LoginForm model which was used for validation, giving the name on the label, data etc…
and then display login page in line, with include LoginForm model ($model):
$this->render('login',array('model'=>$model));
then, when the login page is displayed, click the submit button will taken to FormModel class.
because there sintax like this :
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>
$model is LoginForm class from actionLogin.
and then your input will be validate at:
if($model->validate() && $model->login())
$this->redirect(Yii::app()->user->returnUrl);