4

How do I change the "Password Strength:Weak" and "Passwords Match:no" text on the sign up page. Are there drupal settings for this?

2 Answers 2

5

The two sentences are set by Javascript (/modules/user/user.js) so for this you have to use JS too..

$(".password-strength-title").val("Test");

can replace the first one, but for the other it is more complicate. I have to look deeper.

EDIT

The info are here now I don't know if it is possible to do an alter

EDIT

Ok so for doing what you want 2 steps:

function your_module_element_info_alter(&$type){
  $type['password_confirm']['#process'][] = 'your_module_form_process_password_confirm';
}

Then alter the data:

function your_module_form_process_password_confirm($element){
  $element['#attached']['js'][1]['data']['password']['strengthTitle'] = t("Test Title");
  $element['#attached']['js'][1]['data']['password']['confirmTitle'] = t("Test confirm");

  return $element;
}
3

If you take a look at the source for user_form_process_password_confirm, you will see the strings defined and that they are wrapped in a t(). This means they can be translated and/or overridden.

There are a few ways to do string overrides.

The easiest way is with the String Overrides module. This lets you do everything from the UI.

You can also do it with your settings.php file. If you search for "String overrides:" in that file, you will see an example, but you could do something like:

$conf['locale_custom_strings_en'][''] = array(
  'Password strength:' => 'Your password security is ',
  'Weak' => 'horrible.',
  'Fair' => 'pitiful.',
  'Good' => 'tolerable.',
  'Strong' => 'awesome.',
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.