#StackBounty: #7 Reset password via Services by email, and not by uid

Bounty: 50

I’m trying to POST an email address to the password_reset Services endpoint so that it generates and sends a password reset email for a user. When I post the uid to the endpoint, it does this successfully. That said, I want to post the user’s email to the endpoint (e.g. they type in their email to retrieve their password recovery email). How can I change the below in order to allow this? I tried changing user_load($uid) to user_load_by_mail($uid), but this didn’t work.

user_resource.inc

  'password_reset' => array(
          'access callback' => '_user_resource_access',
          'access arguments' => array('password_reset'),
          'access arguments append' => TRUE,
          'callback' => '_user_resource_password_reset',
          'args' => array(
            array(
              'name' => 'uid',
              'optional' => FALSE,
              'source' => array('path' => 0),
              'type' => 'int',
              'description' => 'The id of the user whose password to reset.',
            ),
          ),
        ),

    /**
     * Send a password reset email for the specified user.
     */
    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;
    }


Get this bounty!!!