0

I currently have:

function mymod_menu() {
    $items['user/password'] = array(
        'title' => 'Request new password',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('user_pass'),
        'access callback' => TRUE,
        'type' => MENU_LOCAL_TASK,
        'file' => 'user.pages.inc',
    );
}

mymod_form_alter() {
if ($form_id == 'user_pass')
    {
        // do form alterations here...
    }
}

The first part isn't really necessary for editing the form. But my problem isn't the form. My problem is that I don't know how to change the IMPLEMENTATION of this form. I want the change the way the entire "forgot password" process works. I have a fully integrated login solution that relies on a separate database, and I now need to be able to access that database to generate a unique forgotten password url, based on different validation rules.

What would I have to override to change the way the forgotten password page works?

1 Answer 1

2

The login system uses various core functions in the core User module to process logins and forgotten passwords. You really don't want to mess with those (don't edit them).

At any rate hook_form_alter cannot change what those functions do but it can change which function is called.

I would suggest a custom module that

  1. Creates your own separate login page with the logic you desire
  2. Has a function that sends an email with the tokenised link to your new form
  3. Alters the user_pass form to call the function in #2 instead of the standard function which you can do by editing $form['#submit'].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.