Roundcube Community Forum

 

change password plugin help

Started by jsig, August 29, 2009, 05:34:52 PM

Previous topic - Next topic

jsig

Hello everyone!!
First, I'm new with Roundcube...

I've got a problem with the change password plugin: it does not work.
I've followed the README file but I think I missed something... (I want to use SQL driver).

- I've installed Roundcube 0.3RC1 and it works very well (I can send/receive emails, create folders...),
- I've enabled the password plugin in main.inc.php and I've created plugins/password/config.inc.php,
- I can see the 'password' tab in Roundcube, but when I try to change password I get this error: 'Could not save new password.'

Here is my config.inc.php file:

$rcmail_config['password_driver'] = 'sql';
$rcmail_config['password_confirm_current'] = true;
$rcmail_config['password_db_dsn'] = '';
$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)'; // Default value!


and here is my error log:

[29-ago-2009 17:22:15] MDB2 Error: not found (-4): _doQuery: [Error message: Could not execute statement]
[Last executed query: SELECT update_passwd('$1$CPyQi\\G.$13nU0hj/wzyLB6xofcXVN1', 'webmaster@**********.com')]
[Native code: 1305]
[Native message: FUNCTION db_roundcube.update_passwd does not exist]

[29-Aug-2009 17:22:15 +0200]: DB Error: MDB2 Error: not found Query: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd('$1$CPyQi\\G.$13nU0hj/wzyLB6xofcXVN1', 'webmaster@********.com')] [Native code: 1305] [Native message: FUNCTION db_roundcube.update_passwd does not exist]  in /home/*****/public_html/webmail/program/include/rcube_mdb2.php on line 623 (POST /?_task=settings&_action=plugin.password-save?_task=&_action=)


I think the problem is that I haven't 'password' column in my user table...
So I have to create it manually or change something?
Is there a 'step by step' tutorial?

Thank you very much for your attention (and sorry for my english)! :)

JohnDoh

I think may be you have not got it config'd right, first you need to set the DSN to access the database where your imap users/passwords are stored, probably not the same as the RC database. Then you need to write the query needed to update that password.

If your user table hasn't got a password field then you are looking in the wrong place (are you looking in the RC user table and not your IMAP user table?) :p
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

Mester74

I have a mail database in MySQL. In this I have an accountuser table. In this table there is a username field with the usernames, and a password field with the passwords. The passwords are stored with MySQL-s ENCRYPT function.

I have this in the password plugin's config.inc.php:

$rcmail_config['password_driver'] = 'sql';
$rcmail_config['password_db_dsn'] = 'mysql://mail:PASSWORD@localhost/mail';

What should I set for the $rcmail_config['password_query'] setting?

Mester74

I found the solution! Maybe it would be helpfull for someone else too.
Just a little Google and some thinking and here it is:

$rcmail_config['password_query'] = 'UPDATE accountuser SET password = ENCRYPT(%p) WHERE username = %u LIMIT 1';

dracorp

Hello
I wrote driver for password plugin for shell users. Its base on squirremail plugin Change_password.
plugins/password/config.inc.php
$rcmail_config['password_driver'] = 'passwd';
$rcmail_config['path_to_chpasswd'] = '/usr/local/sbin/chpasswd';

driver passwd.php
<?php
function password_save($currpass$newpass)
{
$curdir realpath(dirname(__FILE__));
$username escapeshellcmd($_SESSION['username']);
$chpasswd rcmail::get_instance()->config->get('path_to_chpasswd','');
if (
$fh popen("$chpasswd $username $currpass $newpass","w")) {
fwrite($fh,"\n");
$code pclose($fh);
if (
$code == 0)
return 
PASSWORD_SUCCESS;
}
else {
raise_error(array(
'code' => 600,
'type' => 'php',
'file' => __FILE__,
'message' => "Password plugin: Unable to execute $chpasswd"
), truefalse);
}
return 
PASSWORD_ERROR;
}
?>

Program chpasswd is from plugin Change_password.

Maybe it will be useful.