# roundcube password plugin

## Elleni

I tried to activate said plugin for my working mailserver which was initially setup and database created by postfixadmin

```
config['password_db_dsn'] = 'mysql://postfixadminuser:password@localhost/postfixadmin_database';

$config['password_query'] = 'UPDATE `mailbox` SET `password` = %c, WHERE `username` = %u';
```

changes done in plugins/passwort/config.inc.php. 

Am I missing something? 

Result: New password not be saved message when trying to change password in roundcube.

----------

## freke

I haven't tried that plugin, but turning on logging in roundcube (/var/www/localhost/htdocs/roundcube/config/config.inc.php) 

```
// ----------------------------------

// LOGGING/DEBUGGING

// ----------------------------------

// system error reporting, sum of: 1 = log; 4 = show

$config['debug_level'] = 5;

// log driver:  'syslog', 'stdout' or 'file'.

$config['log_driver'] = 'syslog';
```

and adding password to array of plugins in same file

```
// ----------------------------------

// PLUGINS

// ----------------------------------

// List of active plugins (in plugins/ directory)

$config['plugins'] = array('userinfo','password');
```

Gives me this error  *Quote:*   

> PHP Error in /var/www/localhost/htdocs/roundcube/program/lib/Roundcube/rcube_plugin.php (157): Failed to load config from /var/www/localhost/htdocs/roundcube/plugins/password/config.inc.php

 

using the sample-config in the plugins/password dir.

I see there's a change-password USE-flag for Roundcube - you've tried emerging with that?

EDIT:

This was with roundcube-1.3.10 - found out that 1.4.0 was added to the tree and tried that (with change-password USE-flag) - now it seems to use the plugin-config - testing some more  :Smile: 

----------

## freke

I got it working for me with roundcube-1.4.0:

my plugins/password/config.inc.php

```
<?php

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

$config['password_strength_driver'] = null;

$config['password_confirm_current'] = false;

$config['password_minimum_length'] = 0;

$config['password_minimum_score'] = 0;

$config['password_log'] = false;

$config['password_login_exceptions'] = null;

$config['password_hosts'] = null;

$config['password_force_save'] = false;

$config['password_force_new_user'] = false;

$config['password_algorithm'] = 'clear';

$config['password_algorithm_prefix'] = '';

$config['password_blowfish_cost'] = 12;

$config['password_disabled'] = false;

$config['password_username_format'] = '%u';

$config['password_crypt_hash'] = 'md5';

$config['password_idn_ascii'] = false;

$config['password_hash_algorithm'] = 'sha1';

$config['password_hash_base64'] = false;

$config['password_db_dsn'] = 'mysql://[user]:[password]@localhost/[DB]';

$config['password_query'] = 'UPDATE virtual_users SET fullname=%c WHERE email=%u LIMIT 1';
```

Much of which is probably default/not needed (but I just started with the config.inc.php.dist file)

and added password to the plugins-array in config/config.inc.php

I just tried this on a 'dummy' table (fullname) didn't wan't it to change my password  :Smile: 

----------

## Elleni

Hi, thanks for your comments. Unfortunatelly I cant do it correctly apparently. 

I took your file, modified user, password and dbname so it matches my settings that I have in postfixadmin (which had created my database after all). Also replaced fullname with password and virtual_users with mailbox in the query line.  

I dont get it, as 

mysql -u user -p set in config.ini.php has (write-)access to the database

```
MariaDB [dbname]> show tables;

+-----------------------+

| Tables_in_dbname  |

+-----------------------+

| admin                 |

| alias                 |

| alias_domain          |

| config                |

| domain                |

| domain_admins         |

| fetchmail             |

| log                   |

| mailbox               |

| quota                 |

| quota2                |

| vacation              |

| vacation_notification |

+-----------------------+

13 rows i[code]

MariaDB [dbname]> show columns from dbname.mailbox;

+------------+--------------+------+-----+---------------------+-------+

| Field      | Type         | Null | Key | Default             | Extra |

+------------+--------------+------+-----+---------------------+-------+

| username   | varchar(255) | NO   | PRI | NULL                |       |

| password   | varchar(255) | NO   |     | NULL                |       |

| name       | varchar(255) | NO   |     | NULL                |       |

| maildir    | varchar(255) | NO   |     | NULL                |       |

| quota      | bigint(20)   | NO   |     | 0                   |       |

| local_part | varchar(255) | NO   |     | NULL                |       |

| domain     | varchar(255) | NO   | MUL | NULL                |       |

| created    | datetime     | NO   |     | 2000-01-01 00:00:00 |       |

| modified   | datetime     | NO   |     | 2000-01-01 00:00:00 |       |

| active     | tinyint(1)   | NO   |     | 1                   |       |

+------------+--------------+------+-----+---------------------+-------+

10 rows in set (0.01 sec)[/code]n set (0.00 sec)
```

The query in the config.ini.php is: 

```
$config['password_query'] = 'UPDATE mailbox SET password=%c WHERE email=%u LIMIT 1';
```

When trying to change password in roundcube plugin, the result is always the same. I just get a message in roundcube that the password was not changed   :Embarassed: 

Is there any debug logging, that I could activate in order to find out whats going on?

----------

## freke

You can try adding:

```
// system error reporting, sum of: 1 = log; 4 = show

$config['debug_level'] = 5;

// Log SQL queries

$config['sql_debug'] = true;

// log driver:  'syslog', 'stdout' or 'file'.

$config['log_driver'] = 'syslog';
```

To your roundcube/config/config.inc.php

EDIT:

How are your usernames stored in the database ie. is it johndoe@example.com or just johndoe? (would translate to %u or %l - I guess)

----------

## Elleni

Hey Freke, 

its username@domain.com   :Very Happy: 

----------

## Elleni

What would be the correct query in that case? Nothing I tried worked.

----------

