Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: remrem on June 26, 2009, 07:44:01 AM

Title: Resolved - Password plugins
Post by: remrem on June 26, 2009, 07:44:01 AM
This Post is resolved :) thanks rosali

Hi all ;)

First, sorry for my English ... :/

I have a problem with the password plugins...
I want use it with
$rcmail_config['password_driver'] = 'sql';

But my mail password is in an other db (postfix) ...
Server: localhost  -  database: postfix  -   Table: mailbox

How I can modify the password ?


Or ... if you have a nice How to for install and config for poppassd on debian lenny with postfix and virtual mail ... ;)

Big thanks ;)
Title: Password plugins
Post by: remrem on June 30, 2009, 03:17:59 PM
Anyone have an idea ? other plugins ?
Title: Password plugins
Post by: rosali on July 01, 2009, 04:18:57 AM

// SQL Driver options
// ------------------
// PEAR database DSN for performing the query. By default
// Roundcube DB settings are used.
$rcmail_config['password_db_dsn'] = 'mysql://postfix:pass@localhost/mailbox';


... assuming you are using MySQL. Also you have analyze the table structure of mailbox and to adjust ...


$rcmail_config['password_query'] = 'UPDATE `hm_accounts` SET `accountpassword` = %c, `accountpwencryption` = '2' WHERE `accountaddress` = %u LIMIT 1;';


The example above is for hMailServer. I don't know postfix database structure. You have to adjust the query string accordingly. For available macros check the hints in the config file.
Title: Password plugins
Post by: remrem on July 01, 2009, 08:28:43 AM
Hi rosali,

Big thank for your solution, I try this in few hours...

I post here if your solution resolve my problem (or no ... :( )

RĂ©mi :)
Title: Password plugins
Post by: remrem on July 01, 2009, 05:14:53 PM
rosali, Your solution work perfectly !

Big thank !
Now ... fire in the skins ;)
Title: Password plugins
Post by: fms on July 01, 2009, 11:23:25 PM
Please help with password plugin.

I'm having the error: "Could not save new password."

my /usr/local/www/roundcube/plugin/password/config.inc.php
-----------------------------------------------------------
$rcmail_config['password_driver'] = 'sql';

$rcmail_config['password_db_dsn'] = 'mysql://postfix:mypass@localhost/postfix';

// I tried this too:
// $rcmail_config['password_db_dsn'] = 'mysql://postfix:mypass@unix(/tmp/mysql.sock)/postfix';

$rcmail_config['password_query'] = "UPDATE `mailbox` SET `password` = '%c', `modified` = date_format(now(),'%Y-%m-%d %H:%i:%s') WHERE `username` = '%u' LIMIT 1";
-----------------------------------------------------------
Can you see any errors on my settings?

Is there some LOG where I could watch to see if my query is being executed?

Thank you in advance for any help!
Title: Password plugins
Post by: rosali on July 02, 2009, 12:40:19 AM
$rcmail_config['password_db_dsn'] = 'mysql://postfix:mypass@localhost/postfix';

Is the password for mysql postfix user really mypass ?

Also it should not be necessary to quote macros.
Title: Password plugins
Post by: remrem on July 02, 2009, 02:24:40 AM
Hi,

`modified` = date_format(now(),'%Y-%m-%d %H:%i:%s')

remove this ! I think the password dont change because, no quote for dateformat .... ;)


N.B. My english sucks very well ... no ?
Title: Password plugins
Post by: fms on July 02, 2009, 07:46:26 AM
( it WORKED! )

Hi Rosali.

No, no, my password for mysql postfix is another one. And I verified it and it is correct, i.e. I connect using a mysql-client with my "real" password and it works. On my "real" config.inc.php, I use my "real" pass unless "mypass".

I removed:

`modified` = date_format(now(),'%Y-%m-%d %H:%i:%s')


and I removed quotes on macros %c and %u:


$rcmail_config['password_query'] = "UPDATE `mailbox` SET `password` = %c WHERE `username` = %u LIMIT 1";

// and this way works too:

$rcmail_config['password_query'] = "UPDATE `mailbox` SET `password` = %c, modified=now() WHERE `username` = %u LIMIT 1";



(it worked!  -- let me ask: is there any LOG where I could watch and look for errors like this one?)

thank you !!!
Title: This worked for me.
Post by: seanand on September 05, 2009, 01:04:58 AM
Using postfix admin, this worked for me:

its based off of fms's


$rcmail_config['password_query'] = "UPDATE mailbox SET password = ENCRYPT(%p), modified=now() WHERE username = %u LIMIT 1;"


Sean
Title: cpanel addons
Post by: blair.sawler on September 06, 2009, 09:04:07 AM
Hi

Has anyone gotten this to work with cpanel? Currently I have .2.2 working with [v0.2] cPanel Addon (Password, Forward & Vacation), by nemesis, but want to upgrade to .3 stable.

Looking for some guidance..... thanks!
Title: Password plugins
Post by: Big Tom on September 14, 2009, 11:29:20 AM
I would be interested in that as well. I tried to figure it out on my own but just don't have the php skills or knowledge of how cpanel e-mail works.

Tom
Title: Please help me :)
Post by: sumit9451 on September 23, 2009, 11:29:28 PM
Hello i tried this
I want use it with

$rcmail_config['password_driver'] = 'sql';

$rcmail_config['password_db_dsn'] = 'mysql://comp35_rnd02:3aRqSzgezi@localhost/com35_rnd02';

$rcmail_config['password_query'] = 'UPDATE mailbox SET password=%p WHERE username=%u AND password=%o AND domain=%d LIMIT 1';

this i get cannot save the password or sometime blank page.. pLease help
Title: Password plugins
Post by: JohnDoh on September 24, 2009, 02:43:50 AM
are you sure you want username=%u and not username=%l? check the rc error log (rc root/logs/) for any info.
Title: Hello ! PLease help
Post by: sumit9451 on September 24, 2009, 09:39:30 AM
Hello i am not getting any error in log,

I am getting cannot save password !

Please help me I wil be really thankful to you!
Title: HEllo
Post by: sumit9451 on September 24, 2009, 09:41:23 AM
If you need my ftp account for mail i can give :) But please help :) Please please it has a week i am trying on ..
Title: Hello
Post by: sumit9451 on September 24, 2009, 10:22:47 AM
Do i have to create password database in msql if yes then how .. Please provide me steps if possible from starting with database and please...
Title: Password plugins
Post by: fms on September 24, 2009, 10:26:49 AM
Quote from: sumit9451;21637
Hello i tried this
I want use it with

$rcmail_config['password_driver'] = 'sql';

$rcmail_config['password_db_dsn'] = 'mysql://comp35_rnd02:3aRqSzgezi@localhost/com35_rnd02';

$rcmail_config['password_query'] = 'UPDATE mailbox SET password=%p WHERE username=%u AND password=%o AND domain=%d LIMIT 1';

this i get cannot save the password or sometime blank page.. pLease help


Try this:

Code: [Select]

$rcmail_config['password_db_dsn'] = 'mysql://<user>:<password>@unix(/tmp/mysql.sock)/<database>';
$rcmail_config['password_query'] = &quot;UPDATE `mailbox` SET `password` = %c, modified=now() WHERE `username` = %u LIMIT 1&quot;;


In your case:
Code: [Select]

$rcmail_config['password_db_dsn'] = 'mysql://comp35_rnd02:3aRqSzgezi@unix(/tmp/mysql.sock)/your-database-name';
$rcmail_config['password_query'] = "UPDATE `mailbox` SET `password` = %c, modified=now() WHERE `username` = %u LIMIT 1";
Title: Hello thanks but i tried this also and failed to do that ?
Post by: sumit9451 on September 24, 2009, 12:55:16 PM
ITs saying not able to connect database .. Cannot save password. !
Title: Password plugins
Post by: fms on September 24, 2009, 04:36:40 PM
Are you sure
your login on database
is "comp35_rnd02"
and your password is "3aRqSzgezi" ?

First of all, you should try to assure you can log in and can access the database.

Try to use heidisql (http://www.heidisql.com) to test if you can connect to the database.
Title: Hello :( please help me
Post by: sumit9451 on September 24, 2009, 06:16:43 PM
YEs i can access it .. i have tried can you send me once again step by step instruction from starting so i can try once again ... please i used simplescript to uplaod roundcube mail script..  this is my mysql server status

* Server: Localhost via UNIX socket
    * Server version: 5.0.81-community-log
    * Protocol version: 10
    * User: comp35_rnd02@localhost
    * MySQL charset: UTF-8 Unicode (utf8)

Web server

    * Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8k DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635
    * MySQL client version: 5.0.81
    * PHP extension: mysqli
Title: Password plugins
Post by: fms on September 25, 2009, 07:54:54 AM
Where are your users? on what database?

Lets say:
1) your mysql-user: comp35_rnd02
2) your mysql-password:3aRqSzgezi
3) your mysql-database: postfix

So, user comp35_rnd02 should have rights to access postfix database from localhost (assuming RoundCube is running on same machine where mysql is)
Code: [Select]

#mysql
mysql> GRANT ALL ON postfix.* TO comp35_rnd02@localhost IDENTIFIED BY '3aRqSzgezi'; FLUSH PRIVILEGES;
exit


So, your password-plugin config is something like this:
/usr/local/www/roundcube/config/password/config.inc.php
Code: [Select]

$rcmail_config['password_db_dsn'] = 'mysql://comp35_rnd02:3aRqSzgezi@unix(/tmp/mysql.sock)/postfix';
$rcmail_config['password_query'] = "UPDATE `mailbox` SET `password` = %c, modified=now() WHERE `username` = %u LIMIT 1";
Title: Password plugins
Post by: rosali on September 25, 2009, 09:44:21 AM
@fms: The problem of sumit9451 is, that he is using the imap server of his host. His webspace is controlled by cpanel. I don't think that he has access to postfix database. I'm not familiar with cpanel. I don't know if it is even possible to code a suiteable driver for the current password plugin. MySQL - at least with the credential posted by sumit 9451 - has only access to the RoundCube database.
Title: Password plugins
Post by: fms on September 25, 2009, 12:36:25 PM
humm ok Rosali.

In this case, I dont know a solution for him.
Title: HElllo
Post by: sumit9451 on September 26, 2009, 02:24:19 AM
SO tell me the way ... is this not for cpanel .. what you need  just tell me so i can find and tell you.. pzzzzzzzzzzzzzz
Title: HEllo
Post by: sumit9451 on September 26, 2009, 02:39:53 AM
i have one idea if you support me ... tell me where should i install roundcube manually and i have full control for cpanel...
Title: Hello
Post by: sumit9451 on September 26, 2009, 03:27:28 AM
This is the change password  from cpanel .. if this helps your for me then i am really happy please

https://host293.hostmonster.com:2083/frontend/hostmonster/mail/passwdpop.html?redirectdomain=&email=123&domain=computertreasure.com
Title: Password plugins
Post by: rosali on September 26, 2009, 04:27:28 AM
You don't understand the structure:

RoundCube is a IMAP server client.
The backend is a IMAP server.
The IMAP server or a backend of the IMAP server administers users and passwords.
Really deep insights to your imap server and the user/password administration are necessary to code a php script to jump into it.
At the moment no skilled php programmer and cpanel user has coded a password change driver ...
Title: problem with passwd change plugin
Post by: yinzhen on March 03, 2010, 10:39:02 AM
hello,
 
i use roundcube 0.3.2.30 and have a problem with the Password Plugin. If try to change a Password, there is always the 'internalerror' Message. But if i try out the wrong 'curpasswd' , roundcube detect that it is the wrong psw. and put out the 'passwordincorrect' message.

Seems like Roundcube cant write to the DB.
I use mysql, postfix

There is a error in the log:

Code: [Select]
apache2: MDB2 Error: not found (-4): _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd('qtr$hjhtdjrtdjrdjrtz345z54rt', 'xxxxxxx@xxxxxx.com')] [Native code: 1305] [Native message: FUNCTION roundcubemail.update_passwd does not exist]
Title: Password plugins
Post by: yinzhen on March 05, 2010, 08:06:58 AM
Quote from: yinzhen;25965
hello,
 
i use roundcube 0.3.2.30 and have a problem with the Password Plugin. If .......


uff. a solution.....
first i discovered that the old changepswd plugin (0.2.1) work. so i copied some lines. but in the end (like first page in this thread) it works with:

$rcmail_config['password_db_dsn'] = 'mysqli://username:gfd534PASSgdfGGERR53@localhost/vmail';

$rcmail_config['password_query'] = "UPDATE `mailbox` SET `password` = %c, modified=now() WHERE `username` = %u LIMIT 1";
Title: windows + Hmail + roundcube... cannot change pass
Post by: tmsam on April 08, 2010, 04:34:35 AM
Hi every body, I have install :
1. windows xp
2. wampserver 2.0
3. Hmail 5.3.2
4. Roucube mail 0.3.1

Now can send/Reicv with webmail, pop.. but cannot change password. I have try password

plugin but now success. I think infomation data of user in hmail\database

folder\hmailserver.sdf not in mysql (mysql.initial.sql) . Pls help me.
Title: plugin with erro
Post by: LMSSML on May 23, 2010, 11:56:51 AM
Hi there,

I'm using postfix*postfixadmin+roundcube(4) but I have got one problem I've tried what you have been posted for my case that I think its a general case as indented here.

But got one problem made log on level 4 of roundcube.

When I try to change the password I saw this .

"Parse error: syntax error, unexpected '*' in /var/www/rc3/plugins/password/drivers/sql.php  on line 51"

This appears after pressing button to save password it's almost imediatley.


Any help would be appreciated.
Title: Password plugins
Post by: LMSSML on May 26, 2010, 04:16:57 PM
No chance of help ?
Title: Password plugins
Post by: rosali on May 27, 2010, 12:39:11 AM
Did you configure the following section properly?


// SQL Driver options
// ------------------
// PEAR database DSN for performing the query. By default
// Roundcube DB settings are used.
$rcmail_config['password_db_dsn'] = '';

// The SQL query used to change the password.
// The query can contain the following macros that will be expanded as follows:
//      %p is replaced with the plaintext new password
//      %c is replaced with the crypt version of the new password, MD5 if available
//         otherwise DES.
//      %D is replaced with the dovecotpw-crypted version of the new password
//      %o is replaced with the password before the change
//      %n is replaced with the hashed version of the new password
//      %q is replaced with the hashed password before the change
//      %h is replaced with the imap host (from the session info)
//      %u is replaced with the username (from the session info)
//      %l is replaced with the local part of the username
//         (in case the username is an email address)
//      %d is replaced with the domain part of the username
//         (in case the username is an email address)
// Escaping of macros is handled by this module.
// Default: "SELECT update_passwd(%c, %u)"
$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';


The query should be something like:

UPDATE mailbox SET password=%c  WHERE username=%u
Title: Password plugins
Post by: LMSSML on May 28, 2010, 08:32:44 AM
Hi there,


I use like this:

$rcmail_config['password_query'] = "UPDATE mailbox SELECT password = %c WHERE username = %u";

And I got the following error:

Parse error: syntax error, unexpected '*' in /var/www/rc3/plugins/password/drivers/sql.php on line 51
Title: Password plugins
Post by: rosali on May 28, 2010, 08:53:47 AM
Try without spaces and SELECT is wrong in this context.

$rcmail_config['password_query'] = "UPDATE mailbox SET password=%c WHERE username=%u";
Title: Password plugins
Post by: LMSSML on May 28, 2010, 02:30:19 PM
Hi,
Thanks
for the awnser


But it happends the same :

Parse error: syntax error, unexpected '*' in /var/www/rc3/plugins/password/drivers/sql.php  on line 51


in sql.php line 51

I found this :

*  $sql = str_replace('%c',  $db->quote(crypt($passwd, CRYPT_MD5 ? '$1$'.$salt.'$' : $salt)), $sql);

I removed the asterisk and I've got this:

DB Error in /var/www/rc3/program/include/rcube_mdb2.php (627): MDB2 Error: syntax error Query: _doQuery: [Error message: Could not execute statement] [Last executed query: UPDATE mailbox SET password='$1$50SZH$ec36cegLTG2MSqm7jZ3X11' WHERE username=''teste@example.com''] [Native code: 1064] [Native message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'teste@example.com,''' at line 1]


It worked some problems on '%u' removed and it worked


Thanks a lot.
Title: Password plugins
Post by: rosali on May 30, 2010, 03:46:39 AM
@tmsam ... meanwhile there is a driver for hmailserver. Check out recent svn trunk version.
Title: Portuguese language
Post by: LMSSML on June 01, 2010, 12:25:10 PM
HI there

Everything works fine with rc4 and it's marvelous when I try to change languages to portuguese I get a blank screen when trying to execute the plugin from the interface.

Is it any bug or something that I make wrong ?

In english works
In portuguese (blank screen)

Thanks in advanced.
Title: Password plugins
Post by: LMSSML on June 02, 2010, 02:48:59 AM
Anyone with same problem ?
Title: Password plugins
Post by: rosali on June 02, 2010, 03:31:05 AM
Works for me with portugues. Please post your pt_PT language file and check error logs.
Title: Is like this
Post by: LMSSML on June 03, 2010, 05:04:52 AM
This is labels.inc

And I added the following but if i remove the problem is the same:

Quote
$labels['changepasswd']  = 'Alterar password';
$labels['curpasswd']  = 'Password atual:';
$labels['newpasswd']  = 'Nova password:';
$labels['confpasswd']  = 'Confirmar password:';

And I had the same like labesl.inc and add this:

Quote
$messages['nopassword'] = 'Introduza a nova password.';
$messages['nocurpassword'] = 'Introduza a password actual.';
$messages['passwordincorrect'] = 'Password actual errada.';
$messages['passwordinconsistency'] = 'Password\'s nao combinam, tente novamente..';
$messages['crypterror'] = 'Nao foi possivel gravar a nova password. Funcao de criptografica inexistente.';
$messages['connecterror'] = 'Nao foi possivel gravar a nova password. Erro de ligacao';
$messages['internalerror'] = 'Nao foi possivel gravar a nova password.';


In logs there are no reported errors
Title: Password plugins
Post by: rosali on June 03, 2010, 11:05:34 AM
Why did you alter the program localization? The plugin has it's own localization in ./plugins/password/localization.

You should not have to alter anything!
Title: Password plugins
Post by: LMSSML on June 03, 2010, 11:37:12 AM
Hi there,

I didn't alter any path of files I just add inside each file what I've quoted before

the path still the same
Title: Password plugins
Post by: rosali on June 04, 2010, 12:02:19 AM
I meant you need not to add plugin localization to the default localization.
Title: Password plugins
Post by: LMSSML on June 04, 2010, 09:08:22 AM
Sorry I couldn't understanda what are you saying could tyou detail more ?
Title: Password plugins
Post by: LMSSML on June 06, 2010, 01:00:24 PM
Anyone could explain to me ?
Title: Password plugins
Post by: LMSSML on June 09, 2010, 10:11:57 AM
Anyone with same problem ?