Change email account password using API 2 with reseller credentials
Hello,
I'd like to implement the ability to change the email password from within Roundcube using the cpanel password driver plugin included in Roundcube. I also would like to have a unique shared instance of Roundube for a set of cPanel accounts owned by the same reseller.
After having configured everything I noticed that unfortunately it looks like that API 2 requires the cPanel account credentials, while it doesn't work using reseller (owner) credentials.
I also made some test with custom code calling Email::passwordpop using xmlapi.php, which seems to confirm this. When I try to run it with the reseller credentials I get the following error:
Account does not exist.
Is there a way for a reseller to change email password of the owned account using API 2? Any help would be appreciated. Thanks!
Is there a way for a reseller to change email password of the owned account using API 2? Any help would be appreciated. Thanks!
-
If anyone out there is interested in this, I finally was able to find a solution (thanks also to cPanel support team). I made a modified copy of the roundcube's cpanel password driver (plugins/password/drivers/cpanel.php), anche changed the setPassword as follows: [PHP] function setPassword($address, $password) { if (strpos($address, '@')) { list($data['email">, $data['domain">) = explode('@', $address); } else { list($data['email">, $data['domain">) = array($address, ''); } $data['password"> = $password; // first get cpanel user from domain $query = $this->xmlapi->listaccts('domain', $data['domain">); $query = json_decode($query, true); if($query['status"> != 1) return false; $cpanel_user = $query['acct">[0]['user">; // then we update password $query = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data); $query = json_decode($query, true); if ($query['cpanelresult">['data">[0]['result"> == 1) { return true; } return false; }[/PHP] P.s. In roundcube config file you must use port 2087 and put reseller credentials for this to work. 0 -
I am happy to see you were able to find a solution. Thank you for updating us with the outcome. 0
Please sign in to leave a comment.
Comments
2 comments