I extended the password plugin to allow users to change their password without the need for the CPanel admininstrator credentials in the config file - didn't like that idea.
Here is the package containing 2 files: a new config default file, and a new driver file - just unpack into /plugins/password and then configure the "cpaneluserauth" parameters.
This doesn't seem to work for me. I receive the error:
Could not save new password.
It does seem to properly check the existing password however.
Try this one: http://www.roundcubeforum.net/7-third-party-contributions/46-api-based-plugins/6019-cpanel-password-plugin-update.html
The default change password plugin doesn't seem to run properly with cPanel. And the above cPanel password change like is no longer valid. :--)
The password plugin that comes with Roundcube should work fine with cPanel, the plugin that was talked about here most likely no longer works.
When I test changing a password, it basically says unable to change password. :--)
Have you read the README file and configured it to work with your cpanel account?
I added the below code and it said success when I tested changing a password, but when I logged out and back in, it only logs in with the original password; Any suggestions? :--)
// See README file for list of supported driver names.
$config['password_driver'] = 'chpasswd';
I also tested the below code, but nothing seemed to happen.
// See README file for list of supported driver names.
$config['password_driver'] = 'cpanel';
You also need to read the section for the password driver your attempting to use, most require additional steps and configurations.
Below is all the code that cpanel.php has. I doesn't see to say to change any of it. :--)
<?php
/**
* cPanel Password Driver
*
* Driver that adds functionality to change the users cPanel password.
* Originally written by Fulvio Venturelli <
[email protected]>
*
* Completely rewritten using the cPanel API2 call Email::passwdpop
* as opposed to the original coding against the UI, which is a fragile method that
* makes the driver to always return a failure message for any language other than English
* see http://trac.roundcube.net/ticket/1487015
*
* This driver has been tested with o2switch hosting and seems to work fine.
*
* @version 3.0
* @author Christian Chech <
[email protected]>
*
* Copyright (C) 2005-2013, The Roundcube Dev Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
class rcube_cpanel_password
{
public function save($curpas, $newpass)
{
require_once 'xmlapi.php';
$rcmail = rcmail::get_instance();
$this->cuser = $rcmail->config->get('password_cpanel_username');
// 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'));
$this->xmlapi->set_output('json');
$this->xmlapi->set_debug(0);
return $this->setPassword($_SESSION['username'], $newpass);
}
/**
* Change email account password
*
* @param string $address Email address/username
* @param string $password Email account password
*
* @return int|array Operation status
*/
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;
$query = $this->xmlapi->api2_query($this->cuser, 'Email', 'passwdpop', $data);
$query = json_decode($query, true);
$result = $query['cpanelresult']['data'][0];
if ($result['result'] == 1) {
return PASSWORD_SUCCESS;
}
if ($result['reason']) {
return array(
'code' => PASSWORD_ERROR,
'message' => $result['reason'],
);
}
return PASSWORD_ERROR;
}
}
Its in the README file in the password plugin folder, there is a section for each password driver.
I still don't appear to be cating on to all the README steps for the password plugin. I might have a friend look at that. :--)
I techie friend of mine looked at the pw plugin, and it was also over his head. :--)