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


PHP User::findByEmail方法代碼示例

本文整理匯總了PHP中common\models\User::findByEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::findByEmail方法的具體用法?PHP User::findByEmail怎麽用?PHP User::findByEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common\models\User的用法示例。


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

示例1: safeDown

 /**
  * @inheritdoc
  */
 public function safeDown()
 {
     $authManager = $this->getAuthManager();
     $this->db = $authManager->db;
     $userId = \common\models\User::findByEmail('admin@dev.dev')->id;
     $this->delete($authManager->assignmentTable, ['user_id' => $userId]);
 }
開發者ID:tolik505,項目名稱:bl,代碼行數:10,代碼來源:m150212_160541_insert_admin_assignment.php

示例2: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if (!$this->_user) {
         $this->_user = User::findByEmail($this->username);
     }
     return $this->_user;
 }
開發者ID:Rakeshdrupal,項目名稱:yiifirstliveproject,代碼行數:12,代碼來源:LoginForm.php

示例3: rules

 public function rules()
 {
     return [[['password', 'email', 'title'], 'required', 'on' => self::SCENARIO_NEW], [['email', 'title'], 'required', 'on' => self::SCENARIO_EDIT], ['password', 'string', 'min' => Yii::$app->params['passLength']], ['password_repeat', 'compare', 'compareAttribute' => 'password', 'message' => Yii::t('app', "Passwords don't match")], [['ssid'], 'default', 'value' => helper::getSsid()], [['ssid', 'shop_id'], 'integer'], [['title'], 'string', 'max' => 100], [['description'], 'string', 'max' => 250], 'emailPattern' => ['email', 'email'], 'emailLength' => ['email', 'string', 'max' => 255], 'emailUniqueEdit' => ['email', function ($attribute) {
         if (User::findByEmail($this->email)) {
             $this->addError($attribute, $this->email . Yii::t('app', 'Email already exist'));
         }
     }, 'when' => function () {
         $user = User::findByEmail($this->email);
         if (!empty((array) $user)) {
             return Yii::$app->user->id != $user->id;
             // do not check for current user (my email)
         }
     }, 'on' => self::SCENARIO_EDIT], 'emailUniqueNew' => ['email', function ($attribute, $params) {
         $user = User::findByEmail($this->{$attribute});
         if (!empty((array) $user)) {
             $this->addError($attribute, Yii::t('app', 'Email already exist'));
         }
     }, 'on' => self::SCENARIO_NEW], 'emailTrim' => ['email', 'trim'], 'oldPassCheck' => ['password_old', function ($attribute) {
         $user = User::findIdentity($this->id);
         if (!empty((array) $user)) {
             if ($user->validatePassword($this->password_old)) {
                 $this->addError($attribute, Yii::t('app', 'Password Do not match'));
             }
         }
     }, 'on' => self::SCENARIO_EDIT]];
 }
開發者ID:best-nazar,項目名稱:gb-yii2,代碼行數:26,代碼來源:managerAssistant.php

示例4: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = User::findByEmail($this->email);
     }
     return $this->_user;
 }
開發者ID:brygom,項目名稱:yii2-advanced-template-rbac,代碼行數:12,代碼來源:LoginForm.php

示例5: getUser

 /**
  * Finds user by [[email]]
  *
  * @return User|null
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         $this->_user = User::findByEmail($this->email);
     }
     return $this->_user;
 }
開發者ID:tsurkanovm,項目名稱:think_mobiles_task,代碼行數:12,代碼來源:LoginForm.php

示例6: getUser

 public function getUser()
 {
     if ($this->_user === null) {
         $this->_user = User::findByEmail($this->email);
         $this->_user = $this->_user ? $this->_user : false;
     }
     return $this->_user;
 }
開發者ID:su-xiaolin,項目名稱:ICShop-Yii,代碼行數:8,代碼來源:LoginForm.php

示例7: exsits

 public static function exsits($email)
 {
     $model = User::findByEmail($email);
     if (isset($model->email)) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:CherryPieCo,項目名稱:SB,代碼行數:9,代碼來源:Subscrible.php

示例8: getUser

 /**
  * email 郵箱登錄
  * @user onyony
  * @return bool|null|static
  */
 public function getUser()
 {
     if ($this->_user === false) {
         if (strpos($this->username, "@")) {
             $this->_user = User::findByEmail($this->username);
         } else {
             $this->_user = User::findByUsername($this->username);
         }
     }
     return $this->_user;
 }
開發者ID:iiyii,項目名稱:getyii,代碼行數:16,代碼來源:LoginForm.php

示例9: getUser

 public function getUser()
 {
     if ($this->_user === false) {
         if ($this->scenario === 'loginWithEmail') {
             $this->_user = User::findByEmail($this->email);
         } else {
             $this->_user = User::findByphone($this->phone);
         }
     }
     return $this->_user;
 }
開發者ID:baranov-nt,項目名稱:some-2,代碼行數:11,代碼來源:LoginForm.php

示例10: checkEmail

 public function checkEmail($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $exist = User::findByEmail($this->email);
         if (!$exist) {
             $this->addError($attribute, 'Sorry the user\'s email doesn\'t exists !!!');
         } else {
             $this->invitee = $exist;
         }
     }
 }
開發者ID:fnoorman,項目名稱:dev,代碼行數:11,代碼來源:CodeMemberForm.php

示例11: getUser

 /**
  * Finds user by username or email in 'lwe' scenario.
  *
  * @return User|null|static
  */
 public function getUser()
 {
     if ($this->_user === false) {
         // in 'lwe' scenario we find user by email, otherwise by username
         if ($this->scenario === 'lwe') {
             $this->_user = User::findByEmail($this->email);
         } else {
             $this->_user = User::findByUsername($this->username);
         }
     }
     return $this->_user;
 }
開發者ID:rocketyang,項目名稱:yii2-advanced-template,代碼行數:17,代碼來源:LoginForm.php

示例12: getUser

 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = User::findByEmail($this->username);
         if ($this->_user) {
             return $this->_user;
         } else {
             $this->_user = User::findByphone($this->username);
         }
     }
     return $this->_user;
 }
開發者ID:baranov-nt,項目名稱:setyes,代碼行數:12,代碼來源:LoginForm.php

示例13: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         if (\common\components\Utils::isEmail($this->username)) {
             $this->_user = User::findByEmail($this->username);
         } else {
             $this->_user = User::findByUsername($this->username);
         }
     }
     //var_dump($this->_user);//die;
     return $this->_user;
 }
開發者ID:James88,項目名稱:www.yii2.com,代碼行數:17,代碼來源:LoginForm.php

示例14: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         //Находим пользователя в БД по логину или эл.почте
         $this->_user = User::findByEmail($this->email);
         //Проверяем права доступа, если нет, то делаем вид,
         //что пользователь не найден.
         if (!Yii::$app->user->can('dashboard', ['user' => $this->_user])) {
             $this->_user = null;
         }
     }
     return $this->_user;
 }
開發者ID:BayramovNicat,項目名稱:toyplan,代碼行數:18,代碼來源:LoginForm.php

示例15: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 protected function getUser()
 {
     if ($this->_user === null) {
         $this->_user = User::findByUsername($this->username);
     }
     if ($this->_user === null) {
         $this->_user = User::findByEmail($this->username);
     }
     if (!Yii::$app->user->can('dashboard', ['user' => $this->_user])) {
         $this->_user = null;
         throw new \yii\web\HttpException(403, 'Access is restricted to administrators.', 403);
     }
     return $this->_user;
 }
開發者ID:CherryPieCo,項目名稱:SB,代碼行數:19,代碼來源:LoginForm.php


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