The module works as expected, but the solution used could be improved:

Currently Core's system module defines a form element type password_confirm which has two FAPI process functions itself:

$types['password_confirm'] = array(
    '#input' => TRUE,
    '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
    '#theme_wrappers' => array('form_element'),
  );

system.module - function system_element_info

  • form_process_password_confirm - adds two inputs: password and the confirmation and the validation function
  • user_form_process_password_confirm - adds the JS validation

If we disable user_form_process_password_confirm function using hook_element_info_alter using a better undestanding of Form API we can avoid:

  • execution of a process function that just adds JS that later is going to be overwritten
  • execution of hook_form_FORM_ID_alter
  • an HTTP request asking for user.js that is going to provide code that later will be overwritten
  • additional JS code that overwrites the function to check password strength
  • Here is the patch that changes completely the behaviour of this module and improves performance.

CommentFileSizeAuthor
#1 disablepwstrength.patch1.13 KBjherencia

Comments

jherencia’s picture

StatusFileSize
new1.13 KB

I forgot the patch.

jherencia’s picture

Issue summary: View changes

Added style.

jherencia’s picture

Issue summary: View changes

Minor language mistakes fixed.

nagiek’s picture

This patch works great for me. Can one of the maintainers commit it? If not, given that it's a re-write, maybe you should create another module?

plopesc’s picture

Great patch. Should be committed as soon as possible.
Regards

jherencia’s picture

RTBC, anyone?

lucascaro’s picture

Status: Needs review » Reviewed & tested by the community

awesomely simple. Works perfectly.

walker2238’s picture

One issue I have with this is when users use hook_element_info_alter() to alter the password confirm form.

How could the two work together since if you want to alter the password field (label or description for example) you need to use hook_element_info_alter() to create a MYFORM_form_process_password_confirm function.

For me your solution won't work because of this.

jherencia’s picture

@walker2238 I don't see why could be any conflict. My aproach just removes the process function that adds the JS verification, any other module could add their own.

elBradford’s picture

This works beautifully. I threw it in my template.php of my theme and avoided installing the module altogether. If this module isn't being maintained anymore this should at least go in the Drupal manual somewhere.

jherencia’s picture

Status: Reviewed & tested by the community » Fixed

Well I'm the new maintainer of this module and have just commited the patch:

http://drupalcode.org/project/disablepwstrength.git/commit/18322f5

I've activated the dev spanshot so in some hours it will be generated. I think is tested enough so I will create the 7.1 version tomorrow if nobody complains.

Thank you all for the reviewing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Word missing.