How do I relocate the "Reset password" form? Is there a way to hide and relocate the Reset password form from standard location? The login form needs to be shown as is.

I wasn't able to do what the answer on How to print the local task bar different places depending on the base route? says to do.



I found the No Request New Password module. However, I'd like to still access this form on a special link.
How do I print the local task bar in different places depending on the base route? is about changing where the tabs for local tasks are rendered in the page. It's different from what you want to achieve.

The module you found (No Request New Password) is for removing the Request new password link from block and user page. This is probably part of the task you want to achieve, but you cannot use that module because it has not been completely ported to Drupal 8, and it would not work. If you look at the content of the noreqnewpass.module file, you will notice it is using functions that don't exist anymore in Drupal 8, as in the following hook implementation.

function noreqnewpass_form_alter(&amp;$form, $form_state, $form_id) {
  if (($form_id == 'user_login_block' || $form_id == 'user_login') &amp;&amp; variable_get('noreqnewpass_disabled', true)) {
    $key = array_search('user_login_final_validate', $form['#validate']);
    $form['#validate'][$key] = 'noreqnewpass_user_login_final_validate';
  }
}


The task you want to achieve requires to:


Remove the Reset your password local task from the /user/login page
Change the path associated with the user.pass route
(Eventually) remove the Reset your password link that appears in the login block


The fist step requires a module implementing the following hook.

function custom_menu_local_tasks_alter(&amp;$data, $route_name) {
  // Remove the "Reset your password" tab only from the login page.
  if ($route_name == 'user.login') {
    unset($data['tabs']['0']['user.pass']);
  }
}


The second step requires altering a route another module defines. There isn't any hook to do the task, which requires writing code for an event subscriber. Fortunately, Drupal 8 has a class that can be extended to do the task.

class CustomSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    // Change path '/user/password' to '/hidden/user/reset'.
    if ($route = $collection-&gt;get('user.pass')) {
      $route-&gt;setPath('/hidden/user/reset');
    }
  }

}


An event subscriber is a service using the event_subscriber tag. This means it needs to be defined in the .services.yml file of the module.

For the last step, it's sufficient to alter the login block.

function custom_block_view_user_login_block_alter(array &amp;$build, BlockPluginInterface $block) {
 unset($build['user_links']['#items']['request_password']);
}