Author Topic: [SOLVED] Can not save new password (Password Plugin)  (Read 33138 times)

maffmommie

  • Guest
[SOLVED] Can not save new password (Password Plugin)
« on: July 07, 2012, 03:14:57 PM »
I have configured my config.ini.php file according to SKaero's post http://www.roundcubeforum.net/index.php/topic,9349.msg38038.html#msg38038
I have added the plugin in /email/config/main.ini.php and added email/plugins/password/drivers/cpanel.php file
I am using BlueHost.  However, everytime I attempt to change the password in the application I get the Error: Can not save new password.  Would you happen what the problem is?

Here are my settings:
Code: [Select]
// cPanel Driver options
// --------------------------
// The cPanel Host name
$rcmail_config['password_cpanel_host'] = 'box706.bluehost.com';

// The cPanel admin username
$rcmail_config['password_cpanel_username'] = 'admininfo';

// The cPanel admin password
$rcmail_config['password_cpanel_password'] = '******';

// The cPanel port to use
$rcmail_config['password_cpanel_port'] = 2083;

// Using ssl for cPanel connections?
$rcmail_config['password_cpanel_ssl'] = false;

// The cPanel theme in use
$rcmail_config['password_cpanel_theme'] = 'bluehost';


Code: [Select]
CPanel File

<?php

/**
 * cPanel Password Driver
 *
 * Driver that adds functionality to change the users cPanel password.
 * The cPanel PHP API code has been taken from: http://www.phpclasses.org/browse/package/3534.html
 *
 * This driver has been tested with Hostmonster hosting and seems to work fine.

 *
 * @version 1.0
 * @author Fulvio Venturelli <fulvio@venturelli.org>
 */

class HTTP
{
function HTTP($host$username$password$port$ssl$theme)
{
$this->ssl $ssl 'ssl://' '';
$this->username $username;
$this->password $password;
$this->theme $theme;
$this->auth base64_encode($username ':' $password);
$this->port $port;
$this->host $host;
$this->path $theme '/email/';
}
function getData($url$data '')
{
$url $this->path $url;
if(is_array($data))
{
$url $url '?';
foreach($data as $key=>$value)
{
$dataurl .= urlencode($key) . '=' urlencode($value) . '&';
}
$dataurl substr($dataurl0, -1);
}
$response '';
$fp fsockopen($this->ssl $this->host$this->port);
if(!$fp)
{
return false;
}
$out "POST " $url "  HTTP/1.1\r\n";
        
$out .= 'Authorization: Basic ' $this->auth "\r\n";
        
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
        
$out .= "Content-Length: ".strlen($dataurl)."\r\n";
        
$out .= "Connection: close\r\n\r\n";
        
$out .= $dataurl;


fwrite($fp$out);
while (!feof($fp))
{
$response .= @fgets($fp);
}
fclose($fp);
return $response;
}
}


class 
emailAccount
{          
function emailAccount($host$port$ssl$theme$address$curpass)
{
if(strpos($address'@'))
{
list($this->email$this->domain) = explode('@'$address);
}
else
{
list($this->email$this->domain) = array($address'');
}
$this->HTTP = new HTTP($host$address$curpass$port$ssl$theme);
}

 
/*
  * Change email account password
  *
  * Returns true on success or false on failure.
  * @param string $password email account password
  * @return bool
  */
function setPassword($password)
{
$data['email'] = $this->email;
$data['domain'] = $this->domain;
$data['password'] = $password;
$data['password2'] = $password;
$response $this->HTTP->getData('mail/dopasswdpop.html'$data);
if(strpos($response'success') && !strpos($response'failure'))
{
return true;
}
return false;
}
}


function 
password_save($curpas$newpass)
{
    
$rcmail rcmail::get_instance();

    
// Create a cPanel email object
    
$cPanel = new emailAccount($rcmail->config->get('password_cpanel_host'),
$rcmail->config->get('password_cpanel_port'),
$rcmail->config->get('password_cpanel_ssl'),
$rcmail->config->get('password_cpanel_theme'),
$_SESSION['username'],
    
$rcmail->decrypt($_SESSION['password']));

    if (
$cPanel->setPassword($newpass)){
        return 
PASSWORD_SUCCESS;
    }
    else
    {
       return 
PASSWORD_ERROR;
    }
}

?>

« Last Edit: July 08, 2012, 08:44:52 AM by maffmommie »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Can not save new password (Password Plugin)
« Reply #1 on: July 07, 2012, 03:37:53 PM »
Is there anything in your error logs?

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #2 on: July 07, 2012, 03:40:16 PM »
This is the last error in the error log:

[07-Jul-2012 12:39:00 -0600]: DB Error: MDB2 Error: not found Query: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd('$1$auKAJlNH$dHngX9uyvr3KJLUNUcPr0/', 'support@{masked}.com')] [Native code: 1305] [Native message: FUNCTION {masked}_rnd1.update_passwd does not exist]  in /home4/{masked}/public_html/email/program/include/rcube_mdb2.php on line 719 (POST /email/?_task=settings&_action=plugin.password-save?_task=&_action=)
« Last Edit: July 07, 2012, 03:44:51 PM by maffmommie »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Can not save new password (Password Plugin)
« Reply #3 on: July 07, 2012, 03:43:37 PM »
In <RC root>/plugins/password/config.inc.php you need to change $rcmail_config['password_driver'] to cpanel.

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #4 on: July 07, 2012, 03:46:58 PM »
I just double checked; it is set to cpanel.  That step was written in your instructions on a previous post.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Can not save new password (Password Plugin)
« Reply #5 on: July 07, 2012, 04:48:04 PM »
Well then something is wrong because its trying to run the default sql driver query not use cpanel driver at all. You are editing config.inc.php not config.inc.php.dist right?

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #6 on: July 07, 2012, 04:50:57 PM »
Yes, I made a copy of conf.inc.php.dist and renamed it to conf.inc.php.  then i modified the conf.ini.php file
« Last Edit: July 07, 2012, 04:52:46 PM by maffmommie »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Can not save new password (Password Plugin)
« Reply #7 on: July 07, 2012, 04:52:37 PM »
It is named config.inc.php not conf.ini.php right? Can you post the full file?

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #8 on: July 07, 2012, 04:57:41 PM »
It is named properly.  I keep typing it wrong in the forum.

I have posted the file.  I typed {masked} in the username and password fields for privacy purposes.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Can not save new password (Password Plugin)
« Reply #9 on: July 07, 2012, 05:05:12 PM »
Ok everything looks good there, are your still getting that error when you change the password?

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #10 on: July 07, 2012, 05:06:43 PM »
Yes, I wiped my cached (just to make sure) and tried again and I am still getting the CAN NOT SAVE NEW PASSWORD error.

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #11 on: July 07, 2012, 05:13:54 PM »
Here is something: My error logs aren't updating...the timestamp on my last event isn't anywhere need the time now.  I attempted to change the email password a few minutes ago.

I can still log in with the old password however.  Seems it's not throwing an error.

Just wiped the error file.  Attempted to change password and no error was reported.  However, password still didn't change.  Still getting CAN NOT SAVE NEW PASSWORD message.
« Last Edit: July 07, 2012, 05:17:19 PM by maffmommie »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Can not save new password (Password Plugin)
« Reply #12 on: July 08, 2012, 01:59:11 AM »
Ok then try changing $rcmail_config['password_cpanel_ssl'] to true.

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #13 on: July 08, 2012, 08:17:12 AM »
Still getting ERROR message and no entry in the log file.

maffmommie

  • Guest
Re: Can not save new password (Password Plugin)
« Reply #14 on: July 08, 2012, 08:43:44 AM »
I've fixed my problem!

I think the problem was with the cpanel file.  I over wrote it with the file http://www.bluehostforum.com/showthread.php?20593-How-to-SimpleScript-install-of-Roundcube-with-working-password-plugin

I had multiple bluehost accounts and I just copied the original files and just changed the information need in the config.inc.php and the main.inc.php file.

For future questions about this, I have uploaded the three files for anyone that may need help.  Where I have {masked} that is where you put your information.  Upload the files to the appropriate location via SKaero post: http://www.roundcubeforum.net/index.php/topic,9349.msg38038.html#msg38038. 

Be careful with your main.inc.php file!  If you've registered other plugins, you will have to add them to the PLUGIN section of main.inc.php.  Additionally this is for Roundcube version 0.7.2.

Big thanks to SKaero!  You were patience and persistent and I truly appreciate that.