Skip to content

Commit

Permalink
Update cpanel.php
Browse files Browse the repository at this point in the history
  • Loading branch information
julianmatz committed May 15, 2016
1 parent e34e267 commit 8042955
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions plugins/password/drivers/cpanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ public function save($curpas, $newpass)
$this->xmlapi = new xmlapi($rcmail->config->get('password_cpanel_host'));
$this->xmlapi->set_port($rcmail->config->get('password_cpanel_port'));
// Hash auth
if (!empty($rcmail->config->get('password_cpanel_hash'))) {
$this->xmlapi->hash_auth( $this->cuser, $rcmail->config->get('password_cpanel_hash'));
}
// Pass auth
else if (!empty($rcmail->config->get('password_cpanel_password'))) {
$this->xmlapi->hash_auth( $this->cuser, $rcmail->config->get('password_cpanel_password'));
}
else {
return false;
}
$this->xmlapi->set_output('json');
if (!empty($rcmail->config->get('password_cpanel_hash'))) {
$this->xmlapi->hash_auth( $this->cuser, $rcmail->config->get('password_cpanel_hash'));
}
// Pass auth
else if (!empty($rcmail->config->get('password_cpanel_password'))) {
$this->xmlapi->hash_auth( $this->cuser, $rcmail->config->get('password_cpanel_password'));
}
else {
return false;
}
$this->xmlapi->set_output('json');
$this->xmlapi->set_debug(0);

return $this->setPassword($_SESSION['username'], $newpass);
Expand All @@ -81,14 +81,14 @@ function setPassword($address, $password)
}

$data['password'] = $password;
// Get the cPanel user
$query = $this->xmlapi->listaccts( 'domain', $data['domain'] );
$query = json_decode( $query, true );
if ( $query['status'] != 1 ) {
return false;
}
$cpanel_user = $query['acct'][0]['user'];
// Get the cPanel user
$query = $this->xmlapi->listaccts( 'domain', $data['domain'] );
$query = json_decode( $query, true );
if ( $query['status'] != 1 ) {
return false;
}
$cpanel_user = $query['acct'][0]['user'];

$query = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data);
$query = json_decode($query, true);
Expand Down

0 comments on commit 8042955

Please sign in to comment.