password does not change, please help me

class EditUModel extends ActiveRecord

{
public $city;
public $state;
public $username;
public $email;
public $password;

public function saveData() {
$users = new User();
$user = $users->find()->where([’=’, ‘id’, \Yii::$app->user->identity->id])->one();
if ($_POST[‘EditUModel’][‘username’]){
$user->username = $_POST[‘EditUModel’][‘username’];
$user->city = $_POST[‘EditUModel’][‘city’];
$user->state = $_POST[‘EditUModel’][‘state’];
$user->update();

    $user->password = \Yii::$app->security->generatePasswordHash($_POST['EditUModel']['password']);

    return $user->save(false);
}
    
}

}

Are you sure about the password attribute of $user object? Generally, Yii2 stores the password in the password_hash column.

If you have not modified the user table then you just have to call i.e.

$user->setPassword($_POST['EditUModel']['password']);
$user->save(false);

And this might work.