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.

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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page