diff --git a/models/User.php b/models/User.php index c9d4645..e01bfa9 100644 --- a/models/User.php +++ b/models/User.php @@ -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; - }*/ }