Problem/Motivation

Recently I've got a task with the requirement - "Remove the message %name is not recognized as a username or an email address" because it causes security problems."
When I started to work on it I've discovered that this message is directly hardcoded in the core's code.
(@see core/modules/user/src/Form/UserPasswordForm.php)
I think it would be great to have the opportunity to change/hide this text without the developer's intervention.

Proposed resolution

The idea is to move this text from code to some configuration page/area.

Release notes snippet

Comments

gena.io created an issue. See original summary.

gena.io’s picture

Version: 8.9.x-dev » 9.2.x-dev
longwave’s picture

Issue tags: -core, -user, -user login

The easiest way to do this (or change almost any string in Drupal) without code is to use the Interface Translation module to change the message - you can do this even if your site is only in English.

gena.io’s picture

Completely agree with you but it looks like some kind of workaround. Also, I suppose it's a good practice/etc to move some messages like that from the code into the config system.

gena.io’s picture

longwave’s picture

Please don't add tests on every single environment, unless you are testing a database-specific patch it only needs to be tested once.

gena.io’s picture

Ok, thanks

quietone’s picture

This looks familiar.

The string '%name is not recognized as a username or an email address.' was removed in Drupal 9.2.x. in #1521996: Password reset form reveals whether an email or username is in use in Jan 2021. The idea of making configurable was mentioned but I don't see a discussion on whether it should be configurable or not.

For now. one solution for you would be to reroll the patch in that issue for your version of Drupal and post it in that issue for others to use. Thanks.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

arunkumark’s picture

Do we need this feature of configurable message? As per the issue #1521996: Password reset form reveals whether an email or username is in use we are not enumerating the user information (username or email) in the password reset form. Also, the issue is closed now.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.