summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--install.php2
-rw-r--r--modules/field/field.info.inc12
-rw-r--r--modules/system/system.module2
-rw-r--r--modules/user/user.module65
4 files changed, 40 insertions, 41 deletions
diff --git a/install.php b/install.php
index 9527d8dcf..d43485cf4 100644
--- a/install.php
+++ b/install.php
@@ -1377,8 +1377,6 @@ function install_configure_form($form, &$form_state, &$install_state) {
drupal_set_message(st('All necessary changes to %dir and %file have been made. They have been set to read-only for security.', array('%dir' => $settings_dir, '%file' => $settings_file)));
}
- // Add JavaScript validation.
- _user_password_dynamic_validation();
drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
// Add JavaScript time zone detection.
drupal_add_js('misc/timezone.js');
diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc
index ef6276415..ea3979955 100644
--- a/modules/field/field.info.inc
+++ b/modules/field/field.info.inc
@@ -64,12 +64,12 @@ function _field_info_collate_types($reset = FALSE) {
if ($reset) {
$info = NULL;
- cache_clear_all('field_info_types', 'cache_field');
+ cache_clear_all('field_info_types', 'cache_bootstrap');
return;
}
if (!isset($info)) {
- if ($cached = cache_get('field_info_types', 'cache_field')) {
+ if ($cached = cache_get('field_info_types', 'cache_bootstrap')) {
$info = $cached->data;
}
else {
@@ -137,7 +137,7 @@ function _field_info_collate_types($reset = FALSE) {
}
drupal_alter('field_storage_info', $info['storage types']);
- cache_set('field_info_types', $info, 'cache_field');
+ cache_set('field_info_types', $info, 'cache_bootstrap');
}
}
@@ -168,12 +168,12 @@ function _field_info_collate_fields($reset = FALSE) {
if ($reset) {
$info = NULL;
- cache_clear_all('field_info_fields', 'cache_field');
+ cache_clear_all('field_info_fields', 'cache_field_bootstrap');
return;
}
if (!isset($info)) {
- if ($cached = cache_get('field_info_fields', 'cache_field')) {
+ if ($cached = cache_get('field_info_fields', 'cache_bootstrap')) {
$definitions = $cached->data;
}
else {
@@ -181,7 +181,7 @@ function _field_info_collate_fields($reset = FALSE) {
'field_ids' => field_read_fields(array(), array('include_deleted' => 1)),
'instances' => field_read_instances(),
);
- cache_set('field_info_fields', $definitions, 'cache_field');
+ cache_set('field_info_fields', $definitions, 'cache_bootstrap');
}
// Populate 'field_ids' with all fields.
diff --git a/modules/system/system.module b/modules/system/system.module
index e510cb431..228ffd050 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -368,7 +368,7 @@ function system_element_info() {
);
$types['password_confirm'] = array(
'#input' => TRUE,
- '#process' => array('form_process_password_confirm'),
+ '#process' => array('form_process_password_confirm', 'user_form_process_password_confirm'),
'#theme_wrappers' => array('form_element'),
);
$types['textarea'] = array(
diff --git a/modules/user/user.module b/modules/user/user.module
index 6ca08c524..a136dbde9 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -866,7 +866,6 @@ function user_account_form(&$form, &$form_state) {
$account = $form['#user'];
$register = ($form['#user']->uid > 0 ? FALSE : TRUE);
- _user_password_dynamic_validation();
$admin = user_access('administer users');
$form['#validate'][] = 'user_account_form_validate';
@@ -2951,40 +2950,42 @@ function _user_mail_notify($op, $account, $language = NULL) {
}
/**
- * Add javascript and string translations for dynamic password validation
- * (strength and confirmation checking).
+ * Form element process handler for client-side password validation.
*
- * This is an internal function that makes it easier to manage the translation
- * strings that need to be passed to the javascript code.
+ * This #process handler is automatically invoked for 'password_confirm' form
+ * elements to add the JavaScript and string translations for dynamic password
+ * validation.
+ *
+ * @see system_element_info()
*/
-function _user_password_dynamic_validation() {
- static $complete = FALSE;
+function user_form_process_password_confirm($element) {
global $user;
- // Only need to do once per page.
- if (!$complete) {
- drupal_add_js(drupal_get_path('module', 'user') . '/user.js');
-
- drupal_add_js(array(
- 'password' => array(
- 'strengthTitle' => t('Password strength:'),
- 'hasWeaknesses' => t('To make your password stronger:'),
- 'tooShort' => t('Make it at least 6 characters'),
- 'addLowerCase' => t('Add lowercase letters'),
- 'addUpperCase' => t('Add uppercase letters'),
- 'addNumbers' => t('Add numbers'),
- 'addPunctuation' => t('Add punctuation'),
- 'sameAsUsername' => t('Make it different from your username'),
- 'confirmSuccess' => t('yes'),
- 'confirmFailure' => t('no'),
- 'weak' => t('Weak'),
- 'fair' => t('Fair'),
- 'good' => t('Good'),
- 'strong' => t('Strong'),
- 'confirmTitle' => t('Passwords match:'),
- 'username' => (isset($user->name) ? $user->name : ''))),
- 'setting');
- $complete = TRUE;
- }
+
+ $js_settings = array(
+ 'password' => array(
+ 'strengthTitle' => t('Password strength:'),
+ 'hasWeaknesses' => t('To make your password stronger:'),
+ 'tooShort' => t('Make it at least 6 characters'),
+ 'addLowerCase' => t('Add lowercase letters'),
+ 'addUpperCase' => t('Add uppercase letters'),
+ 'addNumbers' => t('Add numbers'),
+ 'addPunctuation' => t('Add punctuation'),
+ 'sameAsUsername' => t('Make it different from your username'),
+ 'confirmSuccess' => t('yes'),
+ 'confirmFailure' => t('no'),
+ 'weak' => t('Weak'),
+ 'fair' => t('Fair'),
+ 'good' => t('Good'),
+ 'strong' => t('Strong'),
+ 'confirmTitle' => t('Passwords match:'),
+ 'username' => (isset($user->name) ? $user->name : ''),
+ ),
+ );
+
+ $element['#attached']['js'][] = drupal_get_path('module', 'user') . '/user.js';
+ $element['#attached']['js'][] = array('data' => $js_settings, 'type' => 'setting');
+
+ return $element;
}
/**