当前位置: 首页>>代码示例>>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;未经允许,请勿转载。