Example #1
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->redirect(Yii::$app->urlManager->createUrl("user"));
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
Example #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();
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
Example #3
0
 public function actionLogin()
 {
     $this->layout = false;
     if (!\Yii::$app->user->isGuest) {
         return $this->redirect(['admin/index']);
     }
     $model = new LoginForm();
     if ($model->load($_POST) && $model->login()) {
         return $this->redirect(['admin/index']);
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
Example #4
0
 public function actionLogin()
 {
     $this->layout = false;
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         return $this->goBack();
     } else {
         return $this->render('login', ['model' => $model, 'title' => '欢迎使用瞄再买管理平台']);
     }
 }
Example #5
0
 public function actionLogin()
 {
     $this->layout = 'base';
     if (!Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $_SESSION['domain_id'] = Yii::$app->user->identity->domain_id;
         return $this->goBack();
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
Example #6
0
 /**
  * 登录
  * @return string|\yii\web\Response
  */
 public function actionLogin()
 {
     $this->layout = false;
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         if (!Yii::$app->user->identity->changed_password) {
             return $this->redirect(['/site/password']);
         }
         return $this->goHome();
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
 /**
  *
  */
 public function actionLogin()
 {
     // if (!Yii::$app->user->isGuest) {
     // return $this->goHome();
     // }
     $res = new Response();
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $res->success = true;
         $res->message = '登录成功';
     } else {
         $res->success = false;
         $res->message = '登录失败';
     }
     $res->to_json();
 }
Example #8
0
 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->gohome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         Yii::$app->systemlog->add('管理员', '登录');
         return $this->gohome();
     } else {
         if ($model && $model->username) {
             Yii::$app->systemlog->add('管理员:' . $model->username, '登录', '失败', json_encode($model->getErrors()));
         }
         $this->layout = 'login';
         return $this->render('login', ['model' => $model]);
     }
 }
Example #9
0
 public function actionLogin()
 {
     $this->layout = 'main-login';
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $auth = new Authorization(['userID' => \Yii::$app->user->identity->getId()]);
         if (!$auth->save()) {
             \Yii::trace($auth->getErrors());
             \Yii::trace($auth);
         }
         return $this->goBack();
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
Example #10
0
 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $user = Admin::find()->where(['username' => $_POST['LoginForm']['username']])->one();
         //设置session
         $session = Yii::$app->session;
         $session['userid'] = $user->id;
         $session['username'] = $user->username;
         $session['head_image'] = $user->head_image;
         return $this->redirect(['/admin/index']);
     } else {
         return $this->renderPartial('login', ['model' => $model, 'assets_url' => \Yii::$app->params['backend_assets']]);
     }
 }
Example #11
0
 public function actionLogin()
 {
     $this->layout = 'login';
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     $message = [];
     if ($model->load(LsYii::getRequest()->post())) {
         if ($model->login()) {
             $this->redirect(\source\helpers\Url::to(['index']));
         } else {
             foreach ($model->getErrors() as $errors) {
                 foreach ($errors as $error) {
                     $message[] = $error;
                 }
             }
         }
     }
     return $this->render('login', ['model' => $model, 'message' => !empty($message) ? $message[0] : '']);
 }