Roundcube Community Forum

 

password plugin with strength meter

Started by caplod, April 13, 2010, 08:53:12 AM

Previous topic - Next topic

caplod

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 ?

ABerglund

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.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

JohnDoh

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
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

caplod

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.

ABerglund

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.
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

caplod

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).

ABerglund

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;
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA