$user


User Properties

$user->pass

Introduced in Version 2.0

Description

The user's hashed password. Note that this returns a hashed version of the password, so it is not typically useful to get this property. However, it is useful to set this property if you want to change the password. When you change a password, it is assumed to be the non-hashed/non-encrypted version. ProcessWire will hash it automatically when the user is saved.

Echoing the current user's hashed password:

echo $user->pass;

Changing the user's password and saving that change:

setOutputFormatting(false) is required when editing data in a user's fields.

$item = $users->get('myname');
$item->setOutputFormatting(false);
$item->pass = "yo12345";
$users->save($item);							

Please note: you will need to add your own complexity checks for passwords to ensure they meet a minimum length and character requirement.

Related

Post Comment