fernandezekiel

Untitled

Jul 25th, 2013
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. public function actionLogin()
  2.     {
  3.         $model=new LoginForm;
  4.  
  5.         // if it is ajax validation request
  6.         if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
  7.         {
  8.             echo CActiveForm::validate($model);
  9.             Yii::app()->end();
  10.         }
  11.  
  12.         // collect user input data
  13.         if(isset($_POST['LoginForm']))
  14.         {
  15.             $model->attributes=$_POST['LoginForm'];
  16.             // validate user input and redirect to the previous page if valid
  17.             if($model->validate() && $model->login())
  18.                 $this->redirect(Yii::app()->user->returnUrl);
  19.         }
  20.         // display the login form
  21.         $this->render('login',array('model'=>$model));
  22.     }
Add Comment
Please, Sign In to add comment