/** * Logs in a user. * * @return mixed */ public function actionLogin() { $this->layout = 'main_login'; if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); $signupModel = new SignupForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } elseif ($signupModel->load(Yii::$app->request->post())) { if ($user = $signupModel->signup()) { if (Yii::$app->getUser()->login($user)) { $profile = new ProfileCrud(); $profile->user_id = $user->id; $profile->fullname = $user->username; $profile->email = $user->email; $profile->save(); return $this->goHome(); } } } else { return $this->render('login', ['model' => $model, 'signupModel' => $signupModel]); } }
public function actionLogin() { $this->layout = 'strepz_guest'; if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $this->_currentRegion = str_replace('Strepz ', '', Yii::$app->name); $model = new LoginForm(); if ($model->load(Yii::$app->request->post())) { if ($user = $model->checkUsernameExists()) { $userRegion = strtoupper($user->region); if ($model->login()) { if ($userRegion === $this->_currentRegion) { return $this->goBack(); } elseif ($userRegion === 'US' && $this->_currentRegion === 'EU') { if ($this->_auth_key = $model->getUser()->auth_key) { $this->_username = $model->getUser()->username; Yii::$app->user->logout(); return $this->redirect(Yii::$app->params['us_domain'] . 'index.php?r=site%2Flogin-auth&auth_key=' . $this->_auth_key . '&username='******'EU' && $this->_currentRegion === 'US') { if ($this->_auth_key = $model->getUser()->auth_key) { $this->_username = $model->getUser()->username; Yii::$app->user->logout(); return $this->redirect(Yii::$app->params['eu_domain'] . 'index.php?r=site%2Flogin-auth&auth_key=' . $this->_auth_key . '&username='******'login', ['model' => $model]); } } } else { return $this->render('login', ['model' => $model]); } }
public function actionIndexadd() { if (Yii::$app->user->isGuest) { $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } else { return $this->render('/site/login', ['model' => $model]); } } else { $Order = new Order(); $Order->user_id = Yii::$app->user->identity->id; $Order->date_time = date('Y-m-d H:i:s'); $Order->status_id = '1'; $Order->save(); $Card = new CardList(); $Products = $Card->getCardAndCardList(Yii::$app->user->identity->id); $Ord = new Order(); $order_id = $Ord->GetOrderId(Yii::$app->user->identity->id); for ($i = 0; $i < sizeof($Products); $i++) { $Orderlist = new Orderlist(); $Orderlist->order_id = $order_id[0]['MAX(`order_id`)']; $Orderlist->product_id = $Products[$i]['product_id']; $Orderlist->quantity = $Products[$i]['quantity']; $Orderlist->save(); } $card = new Card(); $card->DeleteCardId(Yii::$app->user->identity->id); $order = $Ord->GetOrdersFromID(Yii::$app->user->identity->id); $user = User::find()->where(['id' => Yii::$app->user->identity->id])->one(); return $this->render('index', ['user' => $user, 'order' => $order]); } }
public function actionLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); $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()) { $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()); } } elseif ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(Yii::$app->homeUrl); } else { return $this->render('login', ['model' => $model]); } }
public function actionIndex() { if (Yii::$app->user->isGuest) { $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } else { return $this->render('/site/login', ['model' => $model]); } } else { if (!empty($_POST)) { $model = new User(); $model = User::find()->where(['id' => Yii::$app->user->identity->id])->one(); //$model->username = '******'username']'; //$model->email = '$_POST['email']'; $model->country = $_POST['country']; $model->city = $_POST['city']; $model->street = $_POST['street']; $model->zip_code = $_POST['zip_code']; $model->save(); } $user = User::find()->where(['id' => Yii::$app->user->identity->id])->one(); return $this->render('index', ['user' => $user]); } }
public function actionLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { $request = ""; $dosen = \backend\modules\aitk\models\AitkRDosen::findOne(['account_id' => Yii::$app->user->id]); $asrama = \backend\modules\aitk\models\AitkRAsrama::findOne(['account_id' => Yii::$app->user->id]); if (isset($dosen) || isset($asrama)) { if (isset($dosen)) { $jumlah_request_dosen = \backend\modules\aitk\models\AitkRequest::find()->where(['status_dosen' => NULL, 'dosen_wali' => $dosen->dosen_id])->count(); } $jumlah_request_asrama = \backend\modules\aitk\models\AitkRequest::find()->where(['status_dosen' => 1, 'status_asrama' => NULL])->count(); $total_request = isset($dosen) ? $jumlah_request_dosen : (isset($asrama) ? $jumlah_request_asrama : 0); $url = isset($dosen) ? 'dosenwali' : 'asrama'; if ($total_request > 0) { Yii::$app->getSession()->setFlash('info', ['type' => 'info', 'delay' => 100000, 'icon' => 'glyphicon glyphicon-warning-sign', 'message' => 'Anda Memiliki <a href=' . \yii\helpers\Url::to('index.php?r=aitk/request/' . $url) . '><b>' . $total_request . ' Pending Request</b></a> ', 'title' => 'Pending Request']); } } return $this->redirect(['index']); } else { return $this->render('login', ['model' => $model]); } }
/** * Logs in a user. * * @return mixed */ public function actionLogin() { $this->layout = 'main_login'; if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); $signupModel = new SignupForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } elseif ($signupModel->load(Yii::$app->request->post())) { if ($user = $signupModel->signup()) { if (Yii::$app->getUser()->login($user)) { $profile = new ProfileCrud(); $profile->scenario = 'signup'; $profile->user_id = $user->id; $profile->fullname = $user->username; $profile->email = ' '; $profile->save(); if ($profile->sendEmail($user->email, 1)) { Yii::$app->session->setFlash('success', 'Hi ' . $user->username . ', selamat bergabung. Mohon lakukan verifikasi email dan lengkapi profile anda. '); } else { Yii::$app->session->setFlash('error', 'Maaf, kami tidak dapat mengirimkan email verifikasi untuk anda.'); } return $this->goHome(); } } } else { return $this->render('login', ['model' => $model, 'signupModel' => $signupModel]); } }
public function run() { $model = new LoginForm(); if ($model->load(\Yii::$app->request->post()) && $model->login()) { \Yii::$app->controller->redirect(\Yii::$app->controller->goBack()); } return $this->render('login', ['model' => $model]); }
public function actionLogin() { $model = new LoginForm(); if ($model->load(\Yii::$app->request->post()) && $model->login()) { $this->goBack(); } return $this->render('login', ['model' => $model]); }
public function actionIndex() { $model = new LoginForm(); if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } }
public function actionLogin() { $model = new LoginForm(); if ($model->load($_POST) && $model->login()) { return $this->redirect(array('site/index')); } else { return $this->render('login', array('model' => $model)); } }
public function actionLoginSubmit() { Yii::$app->response->format = Response::FORMAT_JSON; $model = new LoginForm(); if ($model->load(["LoginForm" => Yii::$app->request->post()]) && $model->login()) { return ["code" => 200, "msg" => "登录成功!"]; } return ["code" => 300, "msg" => "登录失败", "errors" => $model->errors]; }
public function actionLogin() { $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->redirect('/board/select'); } else { return $this->render('login', ['model' => $model]); } }
/** * Logs in a user. * * @return mixed */ public function actionLogin() { $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } else { return $this->goHome(); } }
/** * This method implemented to demonstrate the receipt of the token. * Do not use it on production systems. * @return string AuthKey or model with errors */ public function actionLogin() { $model = new LoginForm(); if ($model->load(\Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) { return \Yii::$app->user->identity->getAuthKey(); } else { return $model; } }
protected function doLogin($view, $username = null) { $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } else { $model->username = $username; return $this->render($view, compact('model')); } }
/** * Logs in a user. * * @return mixed */ public function actionLogin() { $this->layout = 'mainlogin'; $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { return $this->redirect('index'); } else { return $this->render('login', ['model' => $model]); } }
public function actionLogin() { $model = new LoginForm(); $requestedData = \Yii::$app->getRequest()->post('fb_token') ? \Yii::$app->getRequest()->post() : \Yii::$app->getRequest()->get(); if ($model->load($requestedData, '') && $model->login()) { return \Yii::$app->user->identity->getAuthKey(); } else { return $model; } }
public function actionLogin() { $model = new LoginForm(); if ($model->load(Yii::$app->request->post())) { Yii::$app->getSession()->setFlash('danger', ['type' => 'danger', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-exclamation-sign', 'message' => 'Usuario o contraseña inválidos', 'title' => 'Ingreso', 'positonY' => 'top', 'positonX' => 'center']); return $this->goHome(); } else { return $this->renderAjax('login', ['model' => $model]); } }
public function actionLogin() { $model = new LoginForm(); if ($model->load(Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) { return ['access_token' => Yii::$app->user->identity->getAuthKey()]; } else { $model->validate(); return $model; } }
public function actionLogin() { $model = new LoginForm(); if ($model->load(Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) { // return Yii::$app->user->identity->getAuthKey(); // return ApiResponse::reponseWithStatus(['accessToken' => Yii::$app->user->identity->getAuthKey(), 'NameUser' => Yii::$app->user->identity->username, 'NameUser' => Yii::$app->user->identity->id]); return ApiResponse::reponseWithStatus(['accessToken' => Yii::$app->user->identity->getAuthKey(), 'NameUser' => Yii::$app->user->identity->username, 'idUser' => Yii::$app->user->identity->id]); } else { return ApiResponse::reponseWithStatus(Yii::$app->getRequest()->getBodyParams(), 403); } }
/** * login api * @return type */ public function actionLogin() { $request = \Yii::$app->request; $data = $request->_get(); $model = new LoginForm(); if ($model->load($data, '') && $model->login()) { return ['code' => 0, 'msg' => '登录成功']; } else { return ['code' => 1, 'msg' => '用户名或密码错误']; } }
public function actionLogin() { if (!Yii::$app->user->isGuest) { return $this->goHome(); } $loginModel = new LoginForm(); if ($loginModel->load(Yii::$app->request->post()) && $loginModel->login()) { return $this->goBack(); } return $this->render('login', ['loginModel' => $loginModel]); }
public function actionSubmitLogin() { $model = new LoginForm(); if ($model->load(Yii::$app->request->post())) { if ($model->login()) { echo "success"; } else { echo "Incorrect email or password."; } } }
public function run() { if ($this->visible) { $user = new LoginForm(); if ($user->load(\Yii::$app->request->post()) && $user->login()) { return \Yii::$app->getResponse()->refresh(); } else { return $this->render('loginWidget', ['user' => $user, 'title' => $this->title]); } } }
public function actionLoginuser() { 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('loginuser', ['model' => $model]); } }
/** * Logs in a user. * * @return mixed */ public function actionLogin() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { $this->redirect(['dashboard/index']); } else { return $this->render('login', ['model' => $model]); } }
public function actionLogin() { if (\Yii::$app->user->isAdmin) { return $this->goHome(); } $model = new LoginForm(); $model->role = 'admin'; if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->redirect(['/dashboard']); } return $this->render('login', ['model' => $model]); }
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->createAbsoluteUrl(['user/admin'])); } else { return $this->render('login', ['model' => $model]); } }
/** * Logs in a user. * * @return mixed */ public function actionAcceso() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } $this->layout = 'invitados'; return $this->render('acceso', ['model' => $model]); }