Ejemplo n.º 1
0
 public function actionLogin()
 {
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->login()) {
             $this->redirect(['admin/default/index']);
         }
     }
     return $this->render('login', ['model' => $model]);
 }
Ejemplo n.º 2
0
 public function actionLogin()
 {
     if (!Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         return $this->goBack();
     }
     return $this->render('login', ['model' => $model]);
 }
 public function actionLogin()
 {
     if (!Yii::$app->getUser()->getIsGuest()) {
         return $this->goHome();
     }
     $this->layout = false;
     $model = new LoginForm();
     if ($model->load(Yii::$app->getRequest()->post()) && $model->login()) {
         return $this->goHome();
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
Ejemplo n.º 4
0
 public function loginAction()
 {
     $form = new LoginForm($this);
     if ($this->POST) {
         if ($form->validate($_POST)) {
             try {
                 $user = User::withCredentials($form->output['default']);
                 $this->user->login($user);
                 return $this->_redirect('');
             } catch (NotEnoughFoundException $ex) {
             }
         }
         $form->input['pasword'] = '';
         Session::error('Invalid login');
     }
     return get_defined_vars();
 }