Roundcube Community Forum

 

Roundcube 1.0.2 with plugin change password

Started by amjad, September 11, 2014, 02:34:44 AM

Previous topic - Next topic

nayrb09

Hi raflie, I have the same problem(The could not save password).

I did try your instruction above but did not solve my problem.

Any tips please..

When i try to manually run the url for change password in the browser address bar, below is the error message.
Sorry, the password you selected cannot be used because it is too weak and would be too easy to guess. Please select a password with strength rating of 50 or higher.

url: https://box450.bluehost.com:2083/cpsess3548139985/frontend/bluehost/mail/dopasswdpop.html?email=bryan&domain=mydomain.com&password=Something!23

Anyone could help me? Thanks

SKaero

It seems like the password your trying to use is too week, pick a stronger password.

nayrb09

Thanks for the reply,SKaero..  ;D
I tried a lot password, but still. I even used their(bluehost) password generator.


I used the write_log method and the result is below. could check it if there is something wrong.

Quote[11-Mar-2015 19:48:43 -0600]: <jo61r1eg> Response:HTTP/1.1 401 Access Denied
Set-Cookie: cprelogin=no; HttpOnly; path=/; port=2083; secure
Set-Cookie: cpsession=%3ai2Ld9CTSzlcDYHYY9rX_NbQBs6PoqE74an8sLc_FOvn9NfpVncx36a4fER4AHTUN%2cf5eb6d560110054f39353ceb1df9e16941e3a06678cb19b189be71013fc25d81; HttpOnly; path=/; port=2083; secure
Server: cpsrvd/11.44.2.4
Content-type: text/html; charset="utf-8"
Connection: close
Date: Thu, 12 Mar 2015 01:48:43 GMT
Content-Length: 2572

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="/cPanel_magic_revision_1263758030/unprotected/cpanel/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cPanel&reg; 11</title>
<link rel="stylesheet" href="/cPanel_magic_revision_1355099890/unprotected/cpanel/style_optimized.css" type="text/css" />
<!--[if IE]>
<style type="text/css">
#mid{
   height:300px;
}
</style>
<![endif]-->
<meta name="robots" content="noindex, nofollow" />
</head>
<body>
<div id="wrap">
   <div id="top"></div>
   <div id="mid">
      <div id="content-wrap" align="center">

<script type="text/javascript">
  var url = "https://my.bluehost.com/cgi/account/cpanel";
  var query = window.location.search;
  var c = query.indexOf("failurl=");
  if (c >= 0) {
    var s = query.substring(c + 8);
    if (s.indexOf("&") >= 1)
      s = s.substring(0, s.indexOf("&"));
    url = unescape(s);
  }
  else {
    url = url + "?goto_uri=" + window.location.pathname;
  }
  window.location.href = url;
</script>
<noscript>
  <meta http-equiv="refresh" content="0;url=https://my.bluehost.com/cgi/account/cpanel">
</noscript>
<form action="/login/" method="post" >
    <input type="hidden" name="login_theme" value="cpanel" />
    <table width="200px" class="login" cellpadding="0" cellspacing="0">
        <tr>
            <td align="left" colspan="2"><strong>Login</strong></td>
        </tr>
        <tr>
            <td class="login_lines">Username&nbsp;</td>
            <td class="login_lines"><input autofocus="autofocus" id="user" type="text" name="user" size="16" tabindex="1" /></td>
        </tr>
        <tr class="row2">
            <td class="login_lines">Password&nbsp;</td>
            <td class="login_lines"><input id="pass" type="password" name="pass" size="16" tabindex="2" /></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center"><input type="submit" value="Login" class="input-button" tabindex="3" /></td>
        </tr>
    </table>
    <input type="hidden" name="goto_uri" value="/frontend/rsx3/mail/dopasswdpop.html?email=bryan&amp;domain=aaz-univ.com&amp;password=bryanbulan123456789" />
</form>
<script type="text/javascript">
//<![CDATA[
/* Must not include external javascript -jnk 06.20.09 */
    document.getElementById("user").focus();
//]]>
</script>
</div>
</div>
<div id="bot">
</div>
&copy; cPanel, Inc. 2011
</div>
</body>
</html>

SKaero


nayrb09

I put it after this
Quote$response = $this->HTTP->getData('mail/dopasswdpop.html', $data);

SKaero

Your not using the latest version of the password plugin. Update Roundcube and the password plugin and try again.

nayrb09


SKaero

The line you posted that you put the debug line after is not in the current version of the plugin.

nayrb09

Does below is the latest version?
Quote<?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);

        if ($this->setPassword($_SESSION['username'], $newpass)) {
            return PASSWORD_SUCCESS;
        }
        else {
            return PASSWORD_ERROR;
        }
    }

    /**
     * Change email account password
     *
     * Returns true on success or false on failure.
     * @param string $password email account password
     * @return bool
     */
    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);

        if ($query['cpanelresult']['data'][0]['result'] == 1) {
            return true;
        }

        return false;
    }
}

SKaero


nayrb09

I did try it also, still not working. The message is could not save the password.

SKaero


nayrb09


nayrb09

Please see my attached file.

There is no error log file.

SKaero

Add a log statement after:

$query = $this->xmlapi->api2_query($this->cuser, 'Email', 'passwdpop', $data);