function _user_password_dynamic_validation in Drupal 6
Add javascript and string translations for dynamic password validation (strength and confirmation checking).
This is an internal function that makes it easier to manage the translation strings that need to be passed to the javascript code.
2 calls to _user_password_dynamic_validation()
- install_tasks in ./
install.php - Tasks performed after the database is initialized.
- user_edit_form in modules/
user/ user.module
File
- modules/
user/ user.module, line 2267 - Enables the user registration and login system.
Code
function _user_password_dynamic_validation() {
static $complete = FALSE;
global $user;
// Only need to do once per page.
if (!$complete) {
drupal_add_js(drupal_get_path('module', 'user') . '/user.js', 'module');
drupal_add_js(array(
'password' => array(
'strengthTitle' => t('Password strength:'),
'lowStrength' => t('Low'),
'mediumStrength' => t('Medium'),
'highStrength' => t('High'),
'tooShort' => t('It is recommended to choose a password that contains at least six characters. It should include numbers, punctuation, and both upper and lowercase letters.'),
'needsMoreVariation' => t('The password does not include enough variation to be secure. Try:'),
'addLetters' => t('Adding both upper and lowercase letters.'),
'addNumbers' => t('Adding numbers.'),
'addPunctuation' => t('Adding punctuation.'),
'sameAsUsername' => t('It is recommended to choose a password different from the username.'),
'confirmSuccess' => t('Yes'),
'confirmFailure' => t('No'),
'confirmTitle' => t('Passwords match:'),
'username' => isset($user->name) ? $user->name : '',
),
), 'setting');
$complete = TRUE;
}
}