form_user_form_alter should apply on routes

Created on 2 July 2025, 2 days ago

Problem/Motivation

If you have altered the path of user.reset and user.reset.login routes, then the custom logic in simple_pass_reset_form_user_form_alter won't apply, resulting in this module not working.

Steps to reproduce

In a routeSubscriber:

if ($route = $collection->get('user.reset')) {
   $route->setPath('/whatever/reset/{uid}/{timestamp}/{hash}');
}
if ($route = $collection->get('user.reset.login')) {
   $route->setPath('/whatever/reset/{uid}/{timestamp}/{hash}/login');
}

Then the following code won't apply:

if (isset($path_args[1], $path_args[2]) && $path_args[1] == 'user' && $path_args[2] == 'reset' && \Drupal::currentUser()->isAnonymous()) {

Proposed resolution

Using routes to identify the proper forms we want to alter.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇭🇷Croatia Aporie

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024