def reset_user_password(username, password = nil)
      new_password = password || self.generate_password()
      token = self.auth_token()
      result = HTTParty.put("#{@head_url}/users/#{username}/password", 
                            :body    => {newpassword: new_password}.to_json ,
                            :headers => { 'Content-Type' => 'application/json', 'Authorization'=>"Bearer #{token}" } )

      if result.response.code.to_i == 200
        return new_password
      else
        nil
      end

    end
def reset_user_password(username, password = nil)
      new_password = password || self.generate_password()
      token = self.auth_token()
      result = HTTParty.put("#{@head_url}/users/#{username}/password", 
                            :body    => {newpassword: new_password}.to_json ,
                            :headers => { 'Content-Type' => 'application/json', 'Authorization'=>"Bearer #{token}" } )

      if result.response.code.to_i == 200
        return new_password
      else
        nil
      end

    end
重置用户密码