本文整理汇总了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]);
}
示例2: getUser
/**
* Finds user by [[username]]
*
* @return User|null
*/
public function getUser()
{
if (!$this->_user) {
$this->_user = User::findByEmail($this->username);
}
return $this->_user;
}
示例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]];
}
示例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;
}
示例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;
}
示例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;
}
示例7: exsits
public static function exsits($email)
{
$model = User::findByEmail($email);
if (isset($model->email)) {
return true;
} else {
return false;
}
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}