Description

This function checks a password's strength.

Examples 


https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=PasswdStrength&cpanel_jsonapi_func=get_password_strength&password=12345luggage

$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Check the strength of a given password
$check_password = $cpanel->api2(
    'PasswdStrength', 'get_password_strength', 
    array(
        'password' => '12345luggage',
    ) 
);

 

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Check the strength of a given password
my $check_password = $cpliveapi->api2(
    'PasswdStrength', 'get_password_strength',
    { 
        'password' => '12345luggage',
    }
);

 

cpapi2 --user=username PasswdStrength get_password_strength password=12345luggage

{
  "cpanelresult": {
    "apiversion": 2,
    "func": "get_password_strength",
    "data": [
      {
        "strength": 54
      }
    ],
    "event": {
      "result": 1
    },
    "module": "PasswdStrength"
  }
} 

   

Parameters

ParameterTypeDescriptionPossible valuesExample
passwordstring

Required

The password to check.

A valid string.12345luggage

Returns

ReturnTypeDescriptionPossible valuesExample
strengthinteger

The password's strength.

An integer between 0 and 100.0
reasonstring

A reason for failure.

This function only returns a reason value if it failed.

A string that describes the error.

This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1