I'm sending out mails to existing users telling them their username and password with tokens.
Because there is no way to access the user's password (fortunately!), I'm simply setting a new password. But It seems not to work at all.
This is what I've tried so far:
// Include the password.inc file to use hashing functions require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc'); // This is my user account (dummy function) $account = get_some_user(); // Generates new random password of length 12 $password = user_password(12); // Prepares the new user object and hashes the password $edit = array(); $edit['revision'] = 0; $edit['pass'] = user_hash_password($password); // Saves the user object user_save($account, $edit); // Do stuff with password...
But this does not really work. The password hash gets changed in the
$account[pass] field, I've checked that, but I can't login using the new password.
What did I miss?