diff -upr --unidirectional-new-file password_policy.orig/contrib/password_tab/password_policy_password_tab.install password_policy/contrib/password_tab/password_policy_password_tab.install
--- password_policy.orig/contrib/password_tab/password_policy_password_tab.install 1969-12-31 16:00:00.000000000 -0800
+++ password_policy/contrib/password_tab/password_policy_password_tab.install 2009-06-18 22:02:32.000000000 -0700
@@ -0,0 +1,9 @@
+ 'fieldset',
+ '#title' => t('User Password Tab settings'),
+ '#description' => t('These options adjust User Password form (provided by Password Policy/Password Tab module)'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ );
+ $form['password_tab'] += $myform;
+ $form['password_tab']['#weight'] = $form['registration']['#weight'] + 0.002;
+ break;
+
case "user_profile_form":
unset($form['account']['pass']);
break;
diff -upr --unidirectional-new-file password_policy.orig/contrib/password_tab/password_policy_password_tab.pages.inc password_policy/contrib/password_tab/password_policy_password_tab.pages.inc
--- password_policy.orig/contrib/password_tab/password_policy_password_tab.pages.inc 2008-10-29 07:03:57.000000000 -0700
+++ password_policy/contrib/password_tab/password_policy_password_tab.pages.inc 2009-06-18 23:11:49.438286956 -0700
@@ -10,6 +10,9 @@
* Password change form.
*/
function password_policy_password_tab(&$form_state, $account) {
+ if (function_exists('_user_password_dynamic_validation')) {
+ _user_password_dynamic_validation();
+ }
$form['account']['pass'] = array(
'#type' => 'password_confirm',
'#description' => t('To change the current user password, enter the new password in both fields.'),
@@ -36,6 +39,18 @@ function password_policy_password_tab_va
}
}
+function _password_policy_password_tab_process_redirect($redirect) {
+ global $user;
+ $variables = array('%uid' => $user->uid);
+ $redirect = parse_url(urldecode(strtr($redirect, $variables)));
+
+ // Explicitly create query and fragment elements if not present already.
+ $redirect['query'] = isset($redirect['query']) ? $redirect['query'] : NULL;
+ $redirect['fragment'] = isset($redirect['fragment']) ? $redirect['fragment'] : NULL;
+
+ return $redirect;
+}
+
/**
* Password change form submit.
*/
@@ -44,5 +59,22 @@ function password_policy_password_tab_su
user_module_invoke('submit', $form_state['values'], $account, 'account');
user_save($account, array('pass' => $form_state['values']['pass']));
drupal_set_message(t('Password has been changed.'));
+ // Where do we redirect after password change?
+ $redirect = _password_policy_password_tab_process_redirect(variable_get('password_policy_password_tab_redirect_on_password_change', 'user/%uid'));
+// drupal_goto($redirect['path'], $redirect['query'], $redirect['fragment']);
+ $form_state['redirect'] = $redirect;
}
+
+function _password_policy_password_tab_admin_settings() {
+ $form = array();
+
+ $form['password_policy_password_tab_redirect_on_password_change'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Redirect path on password change'),
+ '#default_value' => variable_get('password_policy_password_tab_redirect_on_password_change', ''),
+ '#description' => t('Normally, after a user changes their password, they will be taken to their user page. Leave this setting blank if you wish to keep the default behavior. If you wish the user to go to a page of your choosing, then enter the path for it here. For instance, you may redirect them to a static page such as node/35, or to the <front> page. You may also use %uid as a variable, and the user\'s user ID will be substituted in the path. In the case where users are first creating their own passwords, it is suggested to use user/%uid/edit here, so the user may set their over account information immediately after validating their account.'),
+ );
+
+ return $form;
+}