diff --git a/password_policy.js b/password_policy.js index 4b22f72..54d078b 100644 --- a/password_policy.js +++ b/password_policy.js @@ -39,7 +39,6 @@ data.name = encodeURIComponent(username); } - // Pass query parameters for correct handling of password reset. $.post( Drupal.settings.basePath + cleanUrlPrefix + Drupal.settings.pathPrefix + 'password_policy/check' + window.location.search, data, @@ -96,8 +95,9 @@ $('fieldset#edit-delay-fieldset', context).drupalSetSummary(function (context) { var delay = $('input[name="delay"]', context).val(); + var threshold = $('input[name="threshold"]', context).val(); if (delay) { - return Drupal.t('@delay between changes', {'@delay': delay}); + return Drupal.t('At most @threshold change(s) in @delay', {'@threshold': threshold, '@delay': delay}); } else { return Drupal.t('Not enforced'); diff --git a/plugins/constraint/delay.inc b/plugins/constraint/delay.inc index 6059906..a20ac75 100644 --- a/plugins/constraint/delay.inc +++ b/plugins/constraint/delay.inc @@ -8,7 +8,7 @@ $plugin = array( 'admin form callback' => 'password_policy_delay_admin_form', 'constraint callback' => 'password_policy_delay_constraint', - 'message' => t('Password cannot be changed within @delay of the last change.'), + 'message' => t('Password cannot be changed within @delay of the last @threshold change(s).'), 'prime value' => 'delay', 'config' => array( 'delay' => NULL, @@ -26,15 +26,16 @@ function password_policy_delay_admin_form($form, &$form_state, $constraint) { ); $sub_form['delay_fieldset']['delay'] = array( '#type' => 'textfield', - '#title' => t('Minimum time between password changes'), + '#title' => t('Time period'), '#default_value' => $constraint->config['delay'], - '#description' => t('Password cannot be changed until this much time has passed since the last password change (use normal English, like 1 week or 24 hours).'), + '#description' => t('Time period during which the number of password changes is restricted. (Use normal English, like 1 week or 24 hours.)'), ); $sub_form['delay_fieldset']['threshold'] = array( '#type' => 'textfield', '#title' => t('Maximum number of times password can be changed per time period'), + '#required' => TRUE, '#default_value' => $constraint->config['threshold'], - '#description' => t('Password can be changed this amount of times per period above (if not defined 1 time).'), + '#description' => t('Password can be changed this many times within period above.'), '#element_validate' => array('element_validate_integer_positive'), ); return $sub_form; @@ -62,8 +63,8 @@ function password_policy_delay_constraint($password, $account, $constraint) { $password_index = !empty($constraint->config['threshold']) ? $constraint->config['threshold'] - 1 : 0; - // If password has been changed less times than allowed by threshold, - // don't apply constraint. + // If password has been changed fewer times than the threshold, the threshold + // cannot be exceeded, so don't apply constraint. if (!isset($account->password_history[$password_index])) { return TRUE; }