The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

passwdpop() function strength rating

Discussion in 'cPanel Developers' started by jaheller, Jun 12, 2017.

  1. jaheller

    jaheller Registered

    Joined:
    May 31, 2017
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Germany
    cPanel Access Level:
    Root Administrator
    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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page