当前位置: 首页>>代码示例>>PHP>>正文


PHP LoginForm::load方法代码示例

本文整理汇总了PHP中app\models\LoginForm::load方法的典型用法代码示例。如果您正苦于以下问题:PHP LoginForm::load方法的具体用法?PHP LoginForm::load怎么用?PHP LoginForm::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\LoginForm的用法示例。


在下文中一共展示了LoginForm::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionLogin

 public function actionLogin()
 {
     $this->layout = 'login';
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $role = Yii::$app->user->identity->getRole(Yii::$app->user->id);
         if ($role == "instructor") {
             $url = Yii::$app->urlManager->createUrl("instructor/instructor");
             $this->redirect($url);
         } else {
             if ($role == "admin") {
                 $url = Yii::$app->urlManager->createUrl("site/dashboard");
                 $this->redirect($url);
             } else {
                 if ($role == "student") {
                     $url = Yii::$app->urlManager->createUrl("student/student");
                     $this->redirect($url);
                 } else {
                     return $this->goBack();
                 }
             }
         }
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
开发者ID:Junaid-Farid,项目名称:olc,代码行数:29,代码来源:SiteController.php

示例2: actionLogin

 public function actionLogin()
 {
     $nombre = null;
     if (!\Yii::$app->user->isGuest) {
         $nombre = $nombre = Yii::$app->user->identity->nombre_usuario;
         if (User::isUserAdmin(Yii::$app->user->identity->id)) {
             $this->redirect(['usuario/admin']);
         }
         if (User::isUserProfe(Yii::$app->user->identity->id)) {
             $this->redirect(['usuario/profesor']);
         }
         if (User::isUserSubcomision(Yii::$app->user->identity->id)) {
             $this->redirect(['usuario/subcomision']);
         }
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $nombre = Yii::$app->user->identity->nombre_usuario;
         if (User::isUserAdmin(Yii::$app->user->identity->id)) {
             $this->redirect(['usuario/admin']);
         }
         if (User::isUserProfe(Yii::$app->user->identity->id)) {
             $this->redirect(['usuario/profesor']);
         }
         if (User::isUserSubcomision(Yii::$app->user->identity->id)) {
             $this->redirect(['usuario/subcomision']);
         }
     }
     return $this->render('login', ['model' => $model]);
 }
开发者ID:emiherber,项目名称:sgdcae,代码行数:30,代码来源:UsuarioController.php

示例3: actionLogin

 public function actionLogin()
 {
     $endDate = \app\models\Weeks::END_DATE;
     if (date('Y-m-d') > $endDate) {
         return $this->render('unavailable', ['endDate' => $endDate]);
     }
     if (!\Yii::$app->user->isGuest) {
         return $this->AddEssay();
     }
     if (Yii::$app->request->isAjax && Yii::$app->request->get('sendCodePhone')) {
         return $this->sendCodePhone(Yii::$app->request->get('sendCodePhone'));
     } elseif (Yii::$app->request->isAjax && Yii::$app->request->get('checkCode') && Yii::$app->request->get('phone')) {
         return $this->checkCode(Yii::$app->request->get('phone'), Yii::$app->request->get('checkCode'));
     }
     $signupForm = new SignupForm();
     if ($signupForm->load(Yii::$app->request->post()) && $signupForm->signup()) {
         return $this->AddEssay('register');
     }
     $loginForm = new LoginForm();
     if ($loginForm->load(Yii::$app->request->post()) && $loginForm->login()) {
         if (Yii::$app->user->identity->isModerator() || Yii::$app->user->identity->isClient()) {
             return $this->redirect(["/admin/index"]);
         } else {
             return $this->AddEssay('login');
         }
     }
     return $this->render('login', ['loginForm' => $loginForm, 'signupForm' => $signupForm]);
 }
开发者ID:samboleika,项目名称:shell,代码行数:28,代码来源:SiteController.php

示例4: actionIndex

 public function actionIndex()
 {
     $session = Yii::$app->session;
     // count login failed
     $countLogin = 0;
     $session->remove('countLogin');
     if ($session->has('countLogin')) {
         $countLogin = $session->get('countLogin');
     }
     $this->layout = 'loginLayout';
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->login()) {
             $session->remove('countLogin');
             return $this->redirect('/admin/top');
         } else {
             $countLogin++;
             $session->set('countLogin', $countLogin);
         }
     }
     // var_dump($countLogin);
     return $this->render('index', ['model' => $model]);
 }
开发者ID:absol3112,项目名称:sonneboutique,代码行数:26,代码来源:LoginController.php

示例5: actionIndex

 /**
  * Вывод главной страницы с 3 формами:
  * авторизация, регистрация и восстановление
  * пароля. Все 3 обработчика форм
  * лаконичнее располагать по одному
  * запросу
  *
  * @return string|\yii\web\Response
  */
 public function actionIndex()
 {
     if (Yii::$app->user->isGuest) {
         //Авторизация
         $model = new LoginForm();
         if ($model->load(Yii::$app->request->post()) && $model->login()) {
             return $this->goBack();
         }
         //Регистрация
         $reg = new RegForm();
         if ($reg->load(Yii::$app->request->post()) && $reg->save()) {
             Yii::$app->getSession()->setFlash('reg-success');
             return $this->goBack();
         }
         //Восстановление пароля
         $forget = new PasswordResetForm();
         if ($forget->load(Yii::$app->request->post()) && $forget->validate()) {
             if ($forget->sendEmail()) {
                 Yii::$app->getSession()->setFlash('forget-send');
             }
             return $this->goBack();
         }
         return $this->render('index', ['model' => $model, 'reg' => $reg, 'forget' => $forget]);
     } else {
         return $this->render('panel');
     }
 }
开发者ID:Shekhovtsovy,项目名称:yii2-start-auth-app,代码行数:36,代码来源:SiteController.php

示例6: actionLogin

 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $this->layout = 'login';
     $model = new LoginForm();
     $passResetModel = new PasswordResetRequestForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         return $this->goBack();
     } else {
         if ($passResetModel->load(Yii::$app->request->post()) && $passResetModel->validate()) {
             /*Yii::$app->mailer->compose()
                  ->setFrom('test@gmail.com')
                  ->setTo('trantor.php@gmail.com')
                  ->setSubject('Email sent from Yii2-Swiftmailer')
             	 ->setTextBody('asdfasdasd')
                  ->send();*/
             if ($passResetModel->sendEmail()) {
                 Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.');
                 return $this->goHome();
             } else {
                 Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.');
                 return $this->goBack();
             }
         } else {
             return $this->render('login', ['model' => $model, 'passResetModel' => $passResetModel]);
         }
     }
 }
开发者ID:soodsse,项目名称:YII2demo,代码行数:30,代码来源:SiteController.php

示例7: actionLogin

 public function actionLogin()
 {
     $serviceName = Yii::$app->getRequest()->getQueryParam('service');
     if (isset($serviceName)) {
         /** @var $eauth \nodge\eauth\ServiceBase */
         $eauth = Yii::$app->get('eauth')->getIdentity($serviceName);
         $eauth->setRedirectUrl(Yii::$app->getUser()->getReturnUrl());
         $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login'));
         try {
             if ($eauth->authenticate()) {
                 //					var_dump($eauth->getIsAuthenticated(), $eauth->getAttributes()); exit;
                 $identity = User::findByEAuth($eauth);
                 Yii::$app->getUser()->login($identity);
                 // special redirect with closing popup window
                 $eauth->redirect();
             } else {
                 // close popup window and redirect to cancelUrl
                 $eauth->cancel();
             }
         } catch (\nodge\eauth\ErrorException $e) {
             // save error to show it later
             Yii::$app->getSession()->setFlash('error', 'EAuthException: ' . $e->getMessage());
             // close popup window and redirect to cancelUrl
             //				$eauth->cancel();
             $eauth->redirect($eauth->getCancelUrl());
         }
     }
     $model = new LoginForm();
     if ($model->load($_POST) && $model->login()) {
         return $this->goBack();
     } else {
         return $this->render('login', array('model' => $model));
     }
 }
开发者ID:kilinanatoly,项目名称:yii2-eauth-demo,代码行数:34,代码来源:SiteController.php

示例8: actionLogin

 public function actionLogin()
 {
     $model = new LoginForm();
     if (!Yii::$app->user->isGuest or $model->load(Yii::$app->request->post()) && $model->login()) {
         $usuarioActual = UsuariosRoles::find()->where('usuarioId = :id', ['id' => Yii::$app->user->id])->all();
         foreach ($usuarioActual as $ua) {
             if ($ua->roles->nombre == "educacion") {
                 return $this->redirect(["site/escuelas"]);
             } else {
                 if ($ua->roles->nombre == "Proyectos") {
                     return $this->redirect(['proyectos/index']);
                 } else {
                     if ($ua->roles->nombre == "eduardo") {
                         return $this->redirect(['dictamenes/index']);
                     } else {
                         if ($ua->roles->nombre == "Zonificacion") {
                             return $this->redirect(['tramite-zonificacion/index']);
                         } else {
                             if ($ua->roles->nombre == "Uso de Suelo") {
                                 return $this->redirect(['tramite-zonificacion/index']);
                                 //$rol = UsuariosRoles::find()->where('usuarioId = '. Yii::$app->user->id)->one();
                                 //$tramites = TipoTramitesRoles::find()->where('roleId = '. $rol->roleId . ' and leer = 1' )->all();
                                 //return $this->redirect(['tipos-tramite/index']);
                                 //'index',['tipos-tramites'=>$tramites]);
                             } else {
                                 if ($ua->roles->nombre == 'Dev') {
                                     return $this->redirect(['tramite-zonificacion/index']);
                                 } else {
                                     if ($ua->roles->nombre == 'pedro') {
                                         return $this->redirect(['tramites-espectaculares/index']);
                                     } else {
                                         if ($ua->roles->nombre == 'Fraccionamiento') {
                                             return $this->redirect(['tramites-autorizacion/index']);
                                         } else {
                                             if ($ua->roles->nombre == 'Construccion') {
                                                 return $this->redirect(['tramites-alineamiento/index']);
                                             } else {
                                                 if ($ua->roles->nombre == 'Sistemas') {
                                                     return $this->redirect(['tipos-tramite/index']);
                                                 } else {
                                                     if ($ua->roles->nombre == "Direccion") {
                                                         return $this->redirect(['tramite-zonificacion/index']);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $requisitos = Requisitos::find()->all();
         return $this->render('login', ['model' => $model, 'requisitos' => $requisitos]);
     }
 }
开发者ID:rzamarripa,项目名称:du,代码行数:59,代码来源:SiteController.php

示例9: actionLogin

 public function actionLogin()
 {
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         return $this->redirect(\Yii::$app->urlManager->createUrl('admin/index'));
     }
     return $this->render('login', ['model' => $model]);
 }
开发者ID:peck94,项目名称:linode,代码行数:8,代码来源:SiteController.php

示例10: actionIndex

 public function actionIndex()
 {
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         return $this->redirect('@web/index.php/profile');
     }
     return $this->render('login', ['model' => $model]);
 }
开发者ID:bishabosha,项目名称:flair,代码行数:8,代码来源:LoginController.php

示例11: actionLogin

 public function actionLogin()
 {
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         $this->goHome();
     }
     return $this->render('login', ['model' => $model]);
 }
开发者ID:NikitaBarinov,项目名称:Yii2App,代码行数:8,代码来源:MainController.php

示例12: actionLogin

 public function actionLogin()
 {
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         return $this->goBack();
     }
     return $this->render('login', compact('model'));
 }
开发者ID:tilhom,项目名称:hello-yii2,代码行数:8,代码来源:MainController.php

示例13: actionIndex

 /**
  * Display login form to authorize user
  */
 public function actionIndex()
 {
     $model = new LoginForm();
     if ($model->load(\Yii::$app->request->post()) && $model->login()) {
         return $this->goBack();
     } else {
         return $this->render('index', ['model' => $model]);
     }
 }
开发者ID:francisberesford,项目名称:econosim-registry,代码行数:12,代码来源:AuthController.php

示例14: actionLogin

 public function actionLogin()
 {
     $model = new LoginForm();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         return $this->redirect(Url::to(['video/index']));
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
开发者ID:abutouq,项目名称:video,代码行数:9,代码来源:SiteController.php

示例15: actionSignin

 /**
  * User auth method.
  * @return array
  */
 public function actionSignin()
 {
     $model = new LoginForm(new User());
     if ($model->load(\Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) {
         return ['token' => \Yii::$app->user->identity->getAuthKey(), 'success' => true];
     } else {
         return ['message' => implode(' ', $model->getFirstErrors()), 'success' => false];
     }
 }
开发者ID:artpro676,项目名称:twitter,代码行数:13,代码来源:AuthController.php


注:本文中的app\models\LoginForm::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。