public setPassword ( string $password ) | ||
$password | string |
public function setPassword($password)
{
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
}
public function resetPassword() { $this->_user = User::findIdentity(Yii::$app->user->id); if (!Yii::$app->getSecurity()->validatePassword($this->password, $this->_user->password_hash)) { throw new InvalidParamException(Yii::t('User', 'source_password_error')); } $this->_user->setPassword($this->new_password); return $this->_user->save(false); }