Module: Code42::API::PasswordReset

Included in:
Client
Defined in:
lib/code42/api/password_reset.rb

Instance Method Summary collapse

Instance Method Details

#reset_password(username_or_id, view_url = nil) ⇒ Object

Send a password reset email to the user identified by username_or_id

Parameters:

  • username_or_id (String, Integer)

    The username or user_id of the user to whom the email should be sent.

  • view_url (String) (defaults to: nil)

    the path of the password-reset form. Defaults to /console/password-reset.html



7
8
9
10
11
12
# File 'lib/code42/api/password_reset.rb', line 7

def reset_password(username_or_id, view_url = nil)
  key    = username_or_id.to_i > 0 ? :userId : :username
  params = { key => username_or_id }
  params.merge!(viewUrl: view_url) if view_url
  post("UserPasswordReset", params)['data']['success']
end