mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Добавлена форма смены пароля и её тесты
This commit is contained in:
@@ -66,14 +66,6 @@ class Account extends ActiveRecord implements IdentityInterface {
|
||||
return static::findOne(['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
* @return static|null
|
||||
*/
|
||||
public static function findByEmail($email) {
|
||||
return static::findOne(['email' => $email]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds user by password reset token
|
||||
*
|
||||
@@ -167,20 +159,8 @@ class Account extends ActiveRecord implements IdentityInterface {
|
||||
* @throws InvalidConfigException
|
||||
*/
|
||||
public function setPassword($password) {
|
||||
switch($this->password_hash_strategy) {
|
||||
case self::PASS_HASH_STRATEGY_OLD_ELY:
|
||||
$password = UserPass::make($this->email, $password);
|
||||
break;
|
||||
|
||||
case self::PASS_HASH_STRATEGY_YII2:
|
||||
$password = Yii::$app->security->generatePasswordHash($password);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new InvalidConfigException('You must specify password_hash_strategy before you can set password');
|
||||
}
|
||||
|
||||
$this->password_hash = $password;
|
||||
$this->password_hash_strategy = self::PASS_HASH_STRATEGY_YII2;
|
||||
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user