本文整理汇总了PHP中common\models\LoginForm::load方法的典型用法代码示例。如果您正苦于以下问题:PHP LoginForm::load方法的具体用法?PHP LoginForm::load怎么用?PHP LoginForm::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\LoginForm
的用法示例。
在下文中一共展示了LoginForm::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLogin
/**
* 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]);
}
}
示例2: actionLogin
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=' . $this->_username);
}
} elseif ($userRegion === '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=' . $this->_username);
}
}
} else {
return $this->render('login', ['model' => $model]);
}
}
} else {
return $this->render('login', ['model' => $model]);
}
}
示例3: actionIndexadd
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]);
}
}
示例4: actionLogin
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]);
}
}
示例5: actionIndex
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 = '$_POST['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]);
}
}
示例6: actionLogin
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]);
}
}
示例7: actionLogin
/**
* 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]);
}
}
示例8: run
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]);
}
示例9: actionLogin
public function actionLogin()
{
$model = new LoginForm();
if ($model->load(\Yii::$app->request->post()) && $model->login()) {
$this->goBack();
}
return $this->render('login', ['model' => $model]);
}
示例10: actionIndex
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);
}
}
示例11: actionLogin
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));
}
}
示例12: actionLoginSubmit
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];
}
示例13: actionLogin
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]);
}
}
示例14: actionLogin
/**
* 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();
}
}
示例15: actionLogin
/**
* 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;
}
}