Method: Chef::WebUIUser#set_password

Defined in:
lib/chef/webui_user.rb

#set_password(password, confirm_password = password) ⇒ Object

Set the password for this object.

Raises:

  • (ArgumentError)


75
76
77
78
79
80
81
# File 'lib/chef/webui_user.rb', line 75

def set_password(password, confirm_password=password) 
  raise ArgumentError, "Passwords do not match" unless password == confirm_password
  raise ArgumentError, "Password cannot be blank" if (password.nil? || password.length==0)
  raise ArgumentError, "Password must be a minimum of 6 characters" if password.length < 6
  @salt = generate_salt
  @password = encrypt_password(@salt, password)      
end