2

How can I disable, in the standard login form, the link for password recovery? I need it for my custom theme.

2

For non-programmers, try No Request New Password module

1

You can use hook_menu_local_tasks_alter().

E.g.

/**
 * Implements hook_menu_local_tasks_alter().
 */
function MY_MODULE_menu_local_tasks_alter(&$data, $route_name) {
  if($route_name == 'user.login') {
    $data['tabs'][0]['user.pass']['#access'] = FALSE;
  }
}

Note: Make sure to replace MY_MODULE with the actual name of your module.

  • It is not working. First a put it into myTheme.theme file and than I tried myModule.module file. But no chance. I still see the password recovery link – lesley n. Oct 21 '17 at 10:40
  • 1
    I actually tested the above code so I know it works. This code should sit in a custom module. Make sure custom modules have info files and are enabled. You will also need to clear the cache before you'll be able to see the change. – Felix Eve Oct 23 '17 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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