Skip to content
Permalink
Browse files
Update User.php
  • Loading branch information
nazimr committed Jan 3, 2022
1 parent 9bb62ea commit e0230d24e6f5ab46782b719549164591e4f5d688
Showing 1 changed file with 2 additions and 76 deletions.
@@ -64,19 +64,14 @@ class User extends ActiveRecord implements IdentityInterface
{
return [
[['name','username','email','password_hash'],'required'],
// ['username', 'trim'],
// ['username', 'required'],
['username', 'unique', 'targetClass' => 'app\models\User', 'message' => 'This username has already been taken.'],
// ['username', 'string', 'min' => 2, 'max' => 255],

// ['email', 'trim'],
// ['email', 'required'],
,
['email', 'email'],
['email', 'string', 'max' => 255],
['email', 'unique', 'targetClass' => 'app\models\User', 'message' => 'This email address has already been taken.'],

// ['password', 'required'],
// ['password', 'string', 'min' => Yii::$app->params['user.passwordMinLength']],

];
}

@@ -107,53 +102,6 @@ class User extends ActiveRecord implements IdentityInterface
return static::findOne(['username' => $username]);
}

/**
* Finds user by password reset token
*
* @param string $token password reset token
* @return static|null
*/
/* public static function findByPasswordResetToken($token)
{
if (!static::isPasswordResetTokenValid($token)) {
return null;
}
return static::findOne([
'password_reset_token' => $token,
'status' => self::STATUS_ACTIVE,
]);
}*/

/**
* Finds user by verification email token
*
* @param string $token verify email token
* @return static|null
*/
/* public static function findByVerificationToken($token) {
return static::findOne([
'verification_token' => $token,
'status' => self::STATUS_INACTIVE
]);
}*/

/**
* Finds out if password reset token is valid
*
* @param string $token password reset token
* @return bool
*/
/* public static function isPasswordResetTokenValid($token)
{
if (empty($token)) {
return false;
}
$timestamp = (int) substr($token, strrpos($token, '_') + 1);
$expire = Yii::$app->params['user.passwordResetTokenExpire'];
return $timestamp + $expire >= time();
}*/

/**
* {@inheritdoc}
@@ -208,27 +156,5 @@ class User extends ActiveRecord implements IdentityInterface
$this->auth_key = Yii::$app->security->generateRandomString();
}

/**
* Generates new password reset token
*/
/* public function generatePasswordResetToken()
{
$this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
}*/

/**
* Generates new token for email verification
*/
/* public function generateEmailVerificationToken()
{
$this->verification_token = Yii::$app->security->generateRandomString() . '_' . time();
}*/

/**
* Removes password reset token
*/
/* public function removePasswordResetToken()
{
$this->password_reset_token = null;
}*/
}

0 comments on commit e0230d2

Please sign in to comment.