User password blank on create
Created 2 years ago by kiltedup

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  —  2 years ago

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

kiltedup  —  2 years 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  —  2 years ago

Hmmm - what am I missing here:



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

password in db entry is NULL

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

Voila. Hashed password appears.