Merge branch 'master' of https://github.com/NETLINK/roundcubemail into NETLINK-master

pull/5193/merge
Aleksander Machniak 8 years ago
commit 4e26cd7691

@ -25,9 +25,10 @@ $config['password_log'] = false;
// will be not available (no Password tab in Settings)
$config['password_login_exceptions'] = null;
// Array of hosts that support password changing. Default is NULL.
// Array of hosts that support password changing.
// Listed hosts will feature a Password option in Settings; others will not.
// Example: array('mail.example.com', 'mail2.example.org');
// Default is NULL (all hosts supported).
$config['password_hosts'] = null;
// Enables saving the new password even if it matches the old password. Useful
@ -307,6 +308,12 @@ $config['password_cpanel_username'] = 'username';
// The cPanel admin password
$config['password_cpanel_password'] = 'password';
// The cPanel admin hash
// If you prefer to use a hash (Remote Access Key) instead of plain password, enter it below.
// Hash takes precedence over password auth.
// You can generate a Remote Access Key in WHM -> Clusters -> Remote Access Key
$config['password_cpanel_hash'] = '';
// The cPanel port to use
$config['password_cpanel_port'] = 2087;

@ -45,7 +45,18 @@ class rcube_cpanel_password
// Setup the xmlapi connection
$this->xmlapi = new xmlapi($rcmail->config->get('password_cpanel_host'));
$this->xmlapi->set_port($rcmail->config->get('password_cpanel_port'));
$this->xmlapi->password_auth($this->cuser, $rcmail->config->get('password_cpanel_password'));
// Hash auth
if (!empty($cpanel_hash = $rcmail->config->get('password_cpanel_hash'))) {
$this->xmlapi->hash_auth( $this->cuser, $cpanel_hash);
}
// Pass auth
else if (!empty($cpanel_password = $rcmail->config->get('password_cpanel_password'))) {
$this->xmlapi->hash_auth( $this->cuser, $cpanel_password);
}
else {
return false;
}
$this->xmlapi->set_output('json');
$this->xmlapi->set_debug(0);
@ -70,8 +81,16 @@ 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'];
$query = $this->xmlapi->api2_query($this->cuser, 'Email', 'passwdpop', $data);
$query = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data);
$query = json_decode($query, true);
$result = $query['cpanelresult']['data'][0];

Loading…
Cancel
Save