function prlp_form_user_pass_reset_alter in Password Reset Landing Page (PRLP) 7.x
Same name and namespace in other branches
- 8 prlp.module \prlp_form_user_pass_reset_alter()
- 6 prlp.module \prlp_form_user_pass_reset_alter()
- 7 prlp.module \prlp_form_user_pass_reset_alter()
Alters the user password reset landing page so that user can enter new password directly on the landing page, and the submit handler can save it.
File
- ./
prlp.module, line 7
Code
function prlp_form_user_pass_reset_alter(&$form, &$form_state) {
@(list($uid, $timestamp, $hashed_pass, $action) = $form_state['build_info']['args']);
if ($uid) {
$form['#user'] = user_load($uid);
// Do this only
if (empty($action)) {
// Inject the username/password change form into the current form.
user_account_form($form, $form_state);
// ???
$form['#user_category'] = 'account';
// Hide email and picture fields.
$form['account']['mail']['#access'] = FALSE;
$form['picture']['#access'] = FALSE;
// Unset $form['#action'] so that the form doesn't get submitted to the
// user profile edit page. Instead it gets submitted to self.
unset($form['#action']);
// Append our own submit handler so we can save the password change
// before sending the user to user profile edit form.
$form['#submit'][] = 'prlp_user_pass_reset_submit';
}
}
}