diff --git a/password_policy.admin.inc b/password_policy.admin.inc index 160a50a..986996b 100644 --- a/password_policy.admin.inc +++ b/password_policy.admin.inc @@ -32,6 +32,14 @@ function password_policy_admin_settings() { '#description' => t("Extra paths, one per line, that the user can access as normal when being forced to change their password. The '*' character is a wildcard. These paths are in addition to the minimally allowed paths for password changes, which are always allowed by Password Policy. This setting can be used, for example, to allow paths requested by custom AJAX on the password change page."), ); + $form['force_change']['password_policy_redirection_path'] = array( + '#type' => 'textfield', + '#title' => t('Custom redirection path when password forced to be changed'), + '#default_value' => variable_get('password_policy_redirection_path', variable_get('password_policy_redirection_path', '')), + '#description' => t("Custom path that the user be redirected when being forced to change their password."), + ); + + $form['expiration'] = array( '#type' => 'fieldset', '#title' => t('Expiration settings'), @@ -120,6 +128,7 @@ function password_policy_admin_settings_submit($form, &$form_state) { variable_set('password_policy_warning_body', $form_state['values']['password_policy_warning_body']); variable_set('password_policy_force_change_reset', $form_state['values']['password_policy_force_change_reset']); variable_set('password_policy_force_change_extra_allowed_paths', $form_state['values']['password_policy_force_change_extra_allowed_paths']); + variable_set('password_policy_redirection_path', $form_state['values']['password_policy_redirection_path']); drupal_set_message(t('The configuration options have been saved.')); break; @@ -132,6 +141,7 @@ function password_policy_admin_settings_submit($form, &$form_state) { variable_del('password_policy_warning_body'); variable_del('password_policy_force_change_reset'); variable_del('password_policy_force_change_extra_allowed_paths'); + variable_del('password_policy_redirection_path'); drupal_set_message(t('The configuration options have been reset to their default values.')); break; } diff --git a/password_policy.module b/password_policy.module index 7727ab4..c2486ed 100644 --- a/password_policy.module +++ b/password_policy.module @@ -868,6 +868,9 @@ function _password_policy_go_to_password_change_page() { * preferred. */ function _password_policy_get_preferred_password_change_path() { + if (!empty(variable_get('password_policy_redirection_path'))) { + return variable_get('password_policy_redirection_path'); + } $password_change_paths = _password_policy_get_password_change_paths(); return $password_change_paths[0]; }