Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

How to remove password strength in Drupal registration form? enter image description here

share|improve this question

migrated from stackoverflow.com Jan 5 '13 at 20:28

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers 3

up vote 2 down vote accepted

Use Password Strength Disabler Drupal Module.

Enabling this module will disable the password strength checker upon new user registration.

share|improve this answer
    
I found this module, but I think fix it without contib module :) –  geph Jan 5 '13 at 10:49
    
Oh, I just copied 4 lines from this module to my module. Thanks. :) –  geph Jan 5 '13 at 11:10
add comment

If you just want to disable it for the user registration form, without using third-party modules, you can use the following code in one of your custom modules.

function mymodule_form_user_register_form_alter(&$form, &$form_state) {
  $form['#attached']['js'][] = drupal_get_path('module', 'mymodule') . '/user.js';
}

The content of the user.js file would be the following.

Drupal.behaviors.password.attach = function (context, settings) {};

Differently from the approach followed by the Password Strength Disabler module, the code I suggest just removes the password strength part from the user registration form, not from every form using the password confirmation form element. The generic code to remove it in more than one form is the following one.

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if (in_array($form_id, $alter_forms)) {
    $form['#attached']['js'][] = drupal_get_path('module', 'mymodule') . '/user.js';
  }
}

$alter_forms is an array containing all the form IDs for the forms where you don't want the password strength to be visible.

share|improve this answer
add comment

I just copied this function from the Disable password strength module into my theme's template.php and it works. YOURTHEME should be changed to your theme name. That's all.

function YOURTHEME_element_info_alter(&$types) {
if (isset($types['password_confirm']['#process']) && (($position = array_search('user_form_process_password_confirm', $types['password_confirm']['#process'])) !== FALSE))
 {
   unset($types['password_confirm']['#process'][$position]);
  }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.