Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Email authentication for password change

Discussion in 'cPanel Developers' started by Hiyak, Aug 4, 2015.

  1. Hiyak

    Hiyak Registered

    Joined:
    Aug 4, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Seattle
    cPanel Access Level:
    Reseller Owner
    PHP:
    <?php
        header
    ("Content-type: text/plain");
        include_once 
    "libs/xmlapi.php";

        
    $xmlapi = new xmlapi("127.255.127.255");
        
    $xmlapi->set_port(2083);
        
    $xmlapi->password_auth("peen""myPassword");

        
    // Change password!
        
    if ($xmlapi->api2_query("peen""Email""passwdpop", array( 'domain' => "mydomain.com"'email' => "peen"'password' => "NewPassword") ))
            echo 
    "Success!";
    ?>
    I have a similar code that works for changing the password for an email account.

    I wanna protect it with the same Email Authentication. The above process resets the password of peen@mydomain.com to NewPassword. This is working great! What I wanna do is, I should have a form, that authenticates the user based on their email address and their old password.

    I checked with the cPanel API 2 Functionsdocumentation, but I couldn't get anywhere to:

    • Get the password of an account.
    • Authenticate an user based on email address and password.
    How am I supposed to proceed with this? Any help on this? Thanks in advance.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice