Closed cansozeri closed 10 years ago
I have found that it is related about beforesave function.
In update process in beforeSave function, this part is not functioning. I do not know why but this part is only work with create call.
if (($this->isNewRecord || in_array($this->getScenario(), ['resetPassword', 'profile'])) && !empty($this->password)) {
$this->password_hash = Security::generatePasswordHash($this->password);
}
So I add
if (!empty($this->password)) {
$this->password_hash = Security::generatePasswordHash($this->password);
}
Now the function is like this and it works, maybe we have to change the first part of the function, if so how ???
public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
if (($this->isNewRecord || in_array($this->getScenario(), ['resetPassword', 'profile'])) && !empty($this->password)) {
$this->password_hash = Security::generatePasswordHash($this->password);
}
if ($this->isNewRecord) {
$this->auth_key = Security::generateRandomKey();
}
if ($this->getScenario() !== \yii\web\User::EVENT_AFTER_LOGIN) {
$this->setAttribute('update_time', new Expression('CURRENT_TIMESTAMP'));
}
if (!empty($this->password)) {
$this->password_hash = Security::generatePasswordHash($this->password);
}
return true;
}
return false;
}
I have same problem. Have you fied it?
This issue have been already fixed. However, could you post the steps for replicating this issue?
I resolved this problem, it was my mistake, sorry. And also. Why do you not use protected functions in you classes? I want to extend your DefaultController, but it use private, and it compels me, copy some private functions. Thanks.
Hello,
When I update the user, everything can be updated but password not, I investigate the logs with yii debug and there is no db request for password update.