function drush_user_password

8.0.x user.drush.inc drush_user_password($inputs)
6.x user.drush.inc drush_user_password($name)
7.x user.drush.inc drush_user_password($inputs)
4.x user.drush.inc drush_user_password($name)
5.x user.drush.inc drush_user_password($name)
master user.drush.inc drush_user_password($inputs)

Sets the password for the account with the given username

File

commands/user/user.drush.inc, line 354
Drush User Management commands

Code

function drush_user_password($inputs) {
  $userlist = new UserList($inputs);
  if (!drush_get_context('DRUSH_SIMULATE')) {
    $pass = drush_get_option('password');
    // If no password has been provided, prompt for one.
    if (empty($pass)) {
      $pass = drush_prompt(dt('Password'), NULL, TRUE, TRUE);
    }
    foreach ($userlist->accounts as $account) {
      $userlist->each('password', array($pass));
    }
    drush_log(dt('Changed password for !users', array('!users' => $userlist->names())), LogLevel::SUCCESS);
  }
}