Class: Lumberg::Cpanel::PasswordStrength

Inherits:
Base show all
Defined in:
lib/lumberg/cpanel/password_strength.rb

Overview

Public: This module provides access to cPanel's password scoring system.

Instance Attribute Summary

Attributes inherited from Base

#api_username

Attributes inherited from Whm::Base

#server

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #perform_request

Methods inherited from Whm::Base

#initialize, #setup_server

Constructor Details

This class inherits a constructor from Lumberg::Cpanel::Base

Class Method Details

.api_moduleObject



5
# File 'lib/lumberg/cpanel/password_strength.rb', line 5

def self.api_module; "PasswdStrength"; end

Instance Method Details

#all_required_strengths(options = {}) ⇒ Object

Public: Return password strength settings set in WHM's 'Main >>

Security Center >> Password Strength Configuration' section.
If this requirement is in place, this function will return
all password strength requirements on a per-application basis.

options - Hash options for API call params (default: {})

Examples

api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
password_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)

password_strength.all_required_strengths

Returns Hash API response.



58
59
60
# File 'lib/lumberg/cpanel/password_strength.rb', line 58

def all_required_strengths(options = {})
  perform_request(options.merge(api_function: 'appstrengths'))
end

#required_strength(options = {}) ⇒ Object

Public: Return the required password strength for a specific

application.

options - Hash options for API call params (default: {})

:app - String The application corresponding to the password strength
       you would like to retrieve. Accepted values include 'htaccess',
       'passwd', 'ftp', 'createacct', 'bandmin', 'cpaddons', 'pop',
       'sshkey', 'postgres', 'webdisk', and 'mysql'.

Examples

api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
password_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)

password_strength.required_strength(app: 'htaccess')

Returns Hash API response.



40
41
42
# File 'lib/lumberg/cpanel/password_strength.rb', line 40

def required_strength(options = {})
  perform_request(options.merge(api_function: 'get_required_strength'))
end

#strength(options = {}) ⇒ Object

Public: Retrieve the strength of a specified password. This API call

is only available in cPanel & WHM 11.32.

options - Hash options for API call params (default: {})

:password - String password to test strength

Examples

api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
passwd_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)

passwd_strength.strength(password: "weakpass")

Returns Hash API response.



20
21
22
# File 'lib/lumberg/cpanel/password_strength.rb', line 20

def strength(options = {})
  perform_request(options.merge(api_function: 'get_password_strength'))
end