User password blank on create

kiltedup - 8 months ago

Morning, Testing a site thats going to get upgraded from 3.0 to 3.3 First issue I have is that when creating a user, the password is blank !!!! Password set as string and then using either repository or model : $users->create($data) or UserModel::create($data) Same result - null password. Was fine before - setPasswordAttribute did its thing. Anything else needed thats related to users and not in the upgrade blog posts? TIA Dave

ryanthompson - 8 months ago

Perhaps composer dump-autoload and clear caches? Can you check to make sure the setPasswordAttribute on the UserModel is being fired?

kiltedup - 8 months ago

Did that. Password is in users_entry if user added via admin. But if manually done with $users->create($data) then it is blank - setPasswordAttribute not firing in this case for me.

kiltedup - 8 months ago

Hmmm - what am I missing here:

```UserRepositoryInterface $users

$users = $users->create( [ 'display_name' => 'Dave', 'email' => '[email protected]', 'password' => 'testing123', 'username' => 'dave', ] );```

password in db entry is NULL

$user->password = 'testing123'; $user->save();

Voila. Hashed password appears.