I have adapted the login procedure with hook_form_FORM_ID_alter so that another database is also checked for credentials. Now I need to change the forgot password validation as well. It seems the FORM_ID of this form is user_pass, however, the hooks I define for that do not trigger. I also tried with hook_form_alter to see what form was triggered, but that hook also never fires (while it does for login for example).

Is the "Request new password" some kind of special form? Is it possible to change the validation handler of this form?

I'm using Drupal 7.

1 Answer 1


Nothing special about this form, you can alter it just like any other:

function MYMODULE_form_user_pass_alter(&$form, &$form_state) {
  $form['#validate'][] = 'MYMODULE_user_pass_validate';

function MYMODULE_user_pass_validate(&$form, &$form_state) {
  // Your code here

Works perfectly fine.

  • Thanks for your reply. Makes sense it should work like that, but it seems this is specific to my installation then because I tried again and without any luck. Strangest thing is that hook_form_alter also will not trigger.
    – Whiskey
    Nov 28, 2011 at 12:03
  • 2
    Have you cleared your cache after implementing the hook? Nov 28, 2011 at 12:49
  • 2
    No way! I can't believe I missed that... Thanks, working now!
    – Whiskey
    Nov 28, 2011 at 14:35

Your Answer

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

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