You are here

function _user_resource_password_reset in Services 7.3

Send a password reset email for the specified user.

1 string reference to '_user_resource_password_reset'
_user_resource_definition in resources/user_resource.inc

File

resources/user_resource.inc, line 817

Code

function _user_resource_password_reset($uid) {
  global $language;
  $account = user_load($uid);
  if (empty($account)) {
    return services_error(t('There is no user with ID @uid.', array(
      '@uid' => $uid,
    )), 404);
  }

  // Mail one time login URL and instructions using current language.
  $mail = _user_mail_notify('password_reset', $account, $language);
  if (!empty($mail)) {
    watchdog('user', 'Password reset instructions mailed to %name at %email.', array(
      '%name' => $account->name,
      '%email' => $account->mail,
    ));
  }
  else {
    watchdog('user', 'There was an error re-sending password reset instructions mailed to %name at %email', array(
      '%name' => $account->name,
      '%email' => $account->mail,
    ));
  }

  // Everything went right.
  return TRUE;
}