passwdpop() function strength rating

  • Thread starter Deleted member 872007
  • Start date
D

Deleted member 872007

Guest
I'm using the below PHP code (using the xml API interface) to change passwords for email accounts:

function change_email_password($xmlapi, $email, $password) {

// Note that $email is just the username part of the email
$req = array("email" => $email, "password" => $password, "domain" => EMAIL_DOMAIN);
$response = $xmlapi->api1_query(CPANEL_USERNAME, "Email", "passwdpop", $req);


$decoded = json_decode($response, true);
return $decoded;
return get_cpanel_reason($decoded, "Failed to change email password for an unknown reason.");
}

Calling the code by using:

die(var_dump(change_email_password(get_cpanel_xmlapi(), 'somemail','3e6agh3tzdafg3wartdwa')));

Returns:

array(8) { ["apiversion"]=> string(1) "1" ["type"]=> string(5) "event" ["module"]=> string(5) "Email" ["func"]=> string(9) "passwdpop" ["source"]=> string(6) "module" ["data"]=> array(1) { ["result"]=> string(233) "
The password that you entered has a strength rating of “0”. You cannot use it because it is too weak and too easy to guess. Please enter a password with a strength rating of “65” or higher. " } ["event"]=> array(2) { ["result"]=> int(0) ["reason"]=> string(224) "Email::passwdpop() failed: The password that you entered has a strength rating of “0”. You cannot use it because it is too weak and too easy to guess. Please enter a password with a strength rating of “65” or higher." } ["error"]=> string(224) "Email::passwdpop() failed: The password that you entered has a strength rating of “0”. You cannot use it because it is too weak and too easy to guess. Please enter a password with a strength rating of “65” or higher." }

Any idea where things go wrong? The strength rating of a password is 0 all the time.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello,

I'm unable to reproduce this issue using the command line to call this cPanel AP 1 function (I also tested with cPanel API 2 and UAPI). Could you verify which version of cPanel is installed on this system? Also, can you reproduce the issue using the command line to call this API function? You can find an example at:

UAPI Functions - Email::passwd_pop - Software Development Kit - cPanel Documentation

Thank you.