Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: caplod on April 13, 2010, 08:53:12 AM

Title: password plugin with strength meter
Post by: caplod on April 13, 2010, 08:53:12 AM
hi there, i modified the password plugin so that it has a strength meter attached to the new password input field.
this works fine. but i have to hardcode the minchars in the javascript.

in the password plugin config.inc.php you can define the parameter $rcmail_config['password_minimum_length'] = 6;

i want to access this parameter from inside the strengthmeter javascript.
in the password.js is see some functions like rcmail.gettext()
but is there a function to read the parameter from config.inc.php ?
Title: password plugin with strength meter
Post by: ABerglund on April 13, 2010, 11:31:33 AM
Please consider sharing this once you have it worked out. I have added an iFrame to my Password plugin that allows a user to test their password prior to changing it, but would vastly prefer an integrated solution.
Title: password plugin with strength meter
Post by: JohnDoh on April 13, 2010, 12:59:02 PM
caplod: try something like
$rcmail->output->set_env('password_minimum_length', $rcmail->config->get('password_minimum_length'));
after the add_label function in password.php and then in the JS you can access it at rcmail.evn.password_minimum_length
Title: password plugin with strength meter
Post by: caplod on April 15, 2010, 07:34:34 AM
JohnDoh: thanks for your hint. (by the way there was a small typo. it should be rcmail.env.password_minimum_length

i have attached my password plugin in case someone is interested in the changes.
i named it syscp_password because i use it to change the userpw in syscp.
Title: password plugin with strength meter
Post by: ABerglund on April 15, 2010, 11:35:35 AM
This is outstanding, and in my opinion should be incorporated into the normal password plugin.

I see only one issue - the password testing messages are hard-coded in German within the javascript. To change to English I had to edit jquery.pstrength-min.1.2.js manually. As it is now coded each localization needs a different jquery.pstrength-min.1.2.js. The descriptions should be moved into the normal localization files, if possible.
Title: password plugin with strength meter
Post by: caplod on April 15, 2010, 12:43:09 PM
hi ABerglund,

you are right , i forgot to mention that the localization is hardcoded.

but here i have attached a version with localization (de and en).
Title: password plugin with strength meter
Post by: ABerglund on April 15, 2010, 02:01:55 PM
Even better. I can use this as is now. It would be nice if - in addition to:
$rcmail_config['password_minimum_length'] = 8;
$rcmail_config['password_require_nonalpha'] = true;


it could also have a couple of other params added, something like:

$rcmail_config['password_require_numeric'] = true;
$rcmail_config['password_require_upper_lower'] = true;