當前位置: 首頁>>代碼示例>>PHP>>正文


PHP models\SignupForm類代碼示例

本文整理匯總了PHP中frontend\models\SignupForm的典型用法代碼示例。如果您正苦於以下問題:PHP SignupForm類的具體用法?PHP SignupForm怎麽用?PHP SignupForm使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SignupForm類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionSignup

 public function actionSignup()
 {
     if (!Yii::$app->user->isGuest) {
         return $this->goBack();
     }
     //new a signup model here
     $signUpModel = new SignupForm();
     if (Yii::$app->request->post()) {
         //load all the data from post into model
         if ($signUpModel->load(Yii::$app->request->post())) {
             //if successed
             if ($user = $signUpModel->signup()) {
                 if (Yii::$app->getUser()->login($user)) {
                     //sent a eamil for validation
                     $mail = Yii::$app->mailer->compose();
                     $mail->setTo($user->username);
                     $mail->setSubject("賬號激活");
                     $validate_url = 'http://localhost/project_colfans/yii2forcolfans/frontend/web/site/validateaccount?user=' . $user->id . '&validation=' . $user->validation;
                     $mail->setHtmlBody('點擊下方鏈接激活賬號,如果您並沒有在Colfans注冊賬號,請忽略此郵件<a style="color:#4383E5;font-size:16px;" href="' . $validate_url . '" target="_blank">點這裏</a>');
                     $mail->send();
                     $this->redirect(['index', 'message' => 'newaccount', 'email' => $user->username]);
                 }
             }
         }
     }
     return $this->render('signup', ['signUpModel' => $signUpModel]);
 }
開發者ID:BonVa,項目名稱:colfans,代碼行數:27,代碼來源:SiteController.php

示例2: createManager

 public function createManager()
 {
     /*echo "Title = ". $this->title. "</br>";
       echo "Description = ".$this->description. "</br>";
       echo "Password = ".$this->password. "</br>";
       echo "ShopID = ".$this->shop_id. "</br>";*/
     $UserAsManager = new SignupForm();
     $UserAsManager->password = $this->password;
     $UserAsManager->email = $this->email;
     $UserAsManager->firmname = '';
     $user = $UserAsManager->signup(false);
     if ($user) {
         $this->userID = $user->id;
         $manager = new Manager();
         $manager->title = $this->title;
         $manager->shop_id = $this->shop_id;
         $manager->description = $this->description;
         $manager->user_id = $this->userID;
         //$manager->ssid = helper::getSsid();
         if ($manager->save(true)) {
             $this->id = $manager->id;
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
開發者ID:best-nazar,項目名稱:gb-yii2,代碼行數:29,代碼來源:managerAssistant.php

示例3: actionCreate

 /**
  * Creates a new UserInfo model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new UserInfo();
     $modelSignUp = new SignupForm();
     $arrSingup = Yii::$app->request->post("SignupForm");
     $modelSignUp->username = $arrSingup["username"];
     $modelSignUp->password = $arrSingup["password"];
     $modelSignUp->email = $arrSingup["email"];
     $arrUserInfo = Yii::$app->request->post("UserInfo");
     $model->load(Yii::$app->request->post());
     $user = $modelSignUp->signup();
     if ($user !== null) {
         $model = $this->findModel($user->id);
         $model->first_name = $arrUserInfo["first_name"];
         $model->last_name = $arrUserInfo["last_name"];
         $model->full_name = $arrUserInfo["full_name"];
         $model->phone = $arrUserInfo["phone"];
         $model->position = $arrUserInfo["position"];
         $model->manager = $arrUserInfo["manager"];
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->user_id]);
         }
     }
     return $this->render('create', ['model' => $model, 'modelSignUp' => $modelSignUp]);
 }
開發者ID:ncuong,項目名稱:lifeguard,代碼行數:30,代碼來源:UserInfoController.php

示例4: actionSignupSubmit

 public function actionSignupSubmit()
 {
     if (isset(Yii::$app->request->post('SignupForm')['checkbox'])) {
         $IsLogin = true;
     } else {
         $IsLogin = false;
     }
     $model = new SignupForm();
     if (Yii::$app->request->isAjax) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         $model->load(Yii::$app->request->post());
         return ActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($user = $model->signup() && $IsLogin) {
             // если есть чекбокс залогинить
             $model->login($user);
             return $this->redirect('/shop/index');
         } else {
             // если не просили залогинить
             //vd(yii::$app->request->isAjax);
             Yii::$app->response->format = Response::FORMAT_JSON;
             Yii::$app->getSession()->setFlash('success', 'Вы успешно зарегистрировались');
             return $this->redirect('/shop/index');
         }
     }
     return $this->redirect('/shop/signup');
 }
開發者ID:kotmonstr,項目名稱:full-shop,代碼行數:28,代碼來源:DefaultController.php

示例5: actionCreate

 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post()) && $model->signup()) {
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:Ermac1988,項目名稱:site-yii2-advanced,代碼行數:14,代碼來源:UserController.php

示例6: submit

 /**
  * @param array $signupData
  */
 public function submit(array $signupData)
 {
     $signupForm = new SignupForm();
     foreach ($signupData as $field => $value) {
         $inputType = $field === 'body' ? 'textarea' : 'input';
         $this->actor->fillField($inputType . '[name="' . $signupForm->formName() . '[' . $field . ']"]', $value);
     }
     $this->actor->click('signup-button');
 }
開發者ID:wangjstu,項目名稱:PHPSTU,代碼行數:12,代碼來源:SignupPage.php

示例7: actionCreateuser

 /**
  * Creates a new User for current Tenant.
  * If creation is successful, the browser will be redirected to Tenant 'view' page.
  * @return mixed
  */
 public function actionCreateuser()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             return $this->actionView($model->tenant_id);
         }
     }
     return $this->render('createuser', ['model' => $model]);
 }
開發者ID:antonio74,項目名稱:daduu42,代碼行數:15,代碼來源:TenantController.php

示例8: actionSignupSubmit

 public function actionSignupSubmit()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $model = new SignupForm();
     if ($model->load(["SignupForm" => Yii::$app->request->post()]) && ($user = $model->signup())) {
         if (Yii::$app->getUser()->login($user)) {
             return ["code" => 200, "msg" => "注冊成功!"];
         }
     }
     return ["code" => 300, "msg" => "注冊失敗", "errors" => $model->errors];
 }
開發者ID:xiaomige,項目名稱:giishop,代碼行數:11,代碼來源:SiteController.php

示例9: saveMember

 public function saveMember($event)
 {
     /** @var \modules\member\models\VerificationCode $verificationCode */
     /** @var Event $event */
     $verificationCode = $event->sender;
     $phone = $verificationCode->field;
     if (wanhunet::$app->user->isGuest) {
         $model = new SignupForm();
         $model->load(['username' => $phone, 'phone' => $phone, 'password' => wanhunet::$app->request->post('password')]);
         $model->signup();
     }
 }
開發者ID:suyuanen,項目名稱:p2p,代碼行數:12,代碼來源:Member.php

示例10: actionSignup

 /**
  * Регистрация
  * @return string|\yii\web\Response
  */
 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             if (Yii::$app->getUser()->login($user)) {
                 return \Yii::$app->getResponse()->redirect(Yii::$app->params['backend_url']);
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
開發者ID:vlamug,項目名稱:landing-page-crm,代碼行數:16,代碼來源:IndexController.php

示例11: actionSignup

 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
開發者ID:KanKai,項目名稱:dsale2015,代碼行數:12,代碼來源:UserController.php

示例12: actionSignup

 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             if (Yii::$app->getUser()->login($user)) {
                 \Yii::$app->getSession()->setFlash('success', 'Ви успішно зареєструвались. Дякуємо, що скористались нашим сервісом.');
                 return $this->goHome();
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
開發者ID:VitaliyProdan,項目名稱:hr,代碼行數:13,代碼來源:SiteController.php

示例13: actionSignup

 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             Yii::$app->db->createCommand()->insert('{{%user_profile}}', ['user_id' => $user->id])->execute();
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
開發者ID:xingcuntian,項目名稱:iisns,代碼行數:13,代碼來源:SiteController.php

示例14: actionSignup

 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             if (Yii::$app->getUser()->login($user)) {
                 Yii::$app->getSession()->setFlash('success', '申請注冊成功,請耐心等待賬號激活');
                 return $this->goHome();
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
開發者ID:dalinhuang,項目名稱:wethepeople,代碼行數:13,代碼來源:SiteController.php

示例15: actionRegister

 public function actionRegister()
 {
     $model = new SignupForm();
     //if($model->load(\Yii::$app->request->post()) && $model->validate())
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         }
     }
     return $this->render('register', ['model' => $model]);
 }
開發者ID:vecherskyy,項目名稱:dom,代碼行數:13,代碼來源:MainController.php


注:本文中的frontend\models\SignupForm類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。