diff --git a/plugins/password/drivers/cpanel.php b/plugins/password/drivers/cpanel.php index af9154a54..79c895db5 100644 --- a/plugins/password/drivers/cpanel.php +++ b/plugins/password/drivers/cpanel.php @@ -46,18 +46,18 @@ class rcube_cpanel_password $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); @@ -81,14 +81,14 @@ class rcube_cpanel_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);