Is it nonsensical to say something does not make sense yet is redundant to something else? Maybe.

You get this bizarre "1 error has been found: username" warning when you fail to log in to D8. This is regardless of whether the username was wrong, or the password, or both. It is in addition to the "real" error message that appears below the field. This doesn't look very polished:

For reference, this is what D7 does:

Edit -Adding so hopefully Inline Form Errors can be disabled for the login form:

The Inline Form Errors core module needs to be enabled to reproduce.

Usability meeting determined that skipping the behavior of the Inline Form Errors module for the login form is a good first step.

Issue fork drupal-2579779

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cilefen created an issue. See original summary.

cilefen’s picture

Issue summary: View changes
cilefen’s picture

Issue tags: +Usability
cilefen’s picture

Status: Active » Needs review
FileSize
1.71 KB

Status: Needs review » Needs work

The last submitted patch, 4: regression_login_form-2579779-4.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
FileSize
2.38 KB

The last submitted patch, 4: regression_login_form-2579779-4.patch, failed testing.

mgifford’s picture

Issue summary: View changes
FileSize
73.85 KB

Here's a screenshot without & also with the patch. The one on the right is with the patch above:

Definitely an improvement.

mgifford’s picture

Issue summary: View changes
FileSize
37.94 KB

Sorry screenshot wit the patch was a different width. This one is a better comparison.

cilefen’s picture

Status: Needs review » Needs work
Issue tags: +Novice

I added the Novice tag because a novice can do the following:

+++ b/core/modules/user/src/Tests/UserBlocksTest.php
@@ -72,8 +72,6 @@ function testUserLoginBlock() {
     $this->drupalPostForm('node', $edit, t('Log in'));
-    $this->assertRaw('1 error has been found:');
-    $this->assertRaw('<a href="#edit-name">Username</a>');
     $this->assertText(t('Unrecognized username or password.'));

These could be converted to ->assertNoRaw.

sdstyles’s picture

Status: Needs work » Needs review
FileSize
2.55 KB
695 bytes
cilefen’s picture

+++ b/core/modules/user/src/Tests/UserBlocksTest.php
@@ -72,9 +72,7 @@ function testUserLoginBlock() {
-    $this->assertRaw('<a href="#edit-name">Username</a>');
-    $this->assertText(t('Unrecognized username or password.'));
+    $this->assertNoRaw('<a href="#edit-name">Username</a>', t('Unrecognized username or password.'));

This is sort-of the idea and it will probably pass the bots, however, this will not do what you intend—you cannot combine asserts like this with assertNoRaw. The second parameter is supposed to be the test log message. You can't pass additional strings to be checked.

Instead, you would replace the ->assertRaw with ->assertNoRaw and ->assertText with ->assertNoText.

But, this issue may not be necessary if the forms issue that inadvertently caused it is reverted, as seems likely.

Bojhan’s picture

Why do we remove the drupal set message, are we special casing this one message?

cilefen’s picture

Yes.

j2r’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
FileSize
55.08 KB

The patch fail to apply - adding tag 'Needs reroll'
When I try to login with invalid username or password I am getting the correct output - Please check the screenshot.

shwetaneelsharma’s picture

FileSize
253 KB

Tried applying regression_login_form-2579779-11.patch. Error attached in the screenshot.

maris.abols’s picture

Assigned: Unassigned » maris.abols
cilefen’s picture

Status: Needs work » Closed (won't fix)
Issue tags: -Novice, -Needs reroll
maris.abols’s picture

Assigned: maris.abols » Unassigned
PeterE’s picture

I am not a fan of patches, so a simple solution for me was to copy the "status-messages.html.twig" template from the core Classy theme into my own theme. I then I added an id (status_message) to the div as follows:

<div data-drupal-messages id="status_message">

Then in css I hid the status message as follows:

.context-user-login #status_message {
	display: none; /* hides redundant error message on login screen */
}
SKAUGHT’s picture

you can also override what the messeage in the block says more directly for your project by putting.

$settings['locale_custom_strings_en'][''] = array(
  'Unrecognized username or password. <a href=":password">Forgot your password?</a>' => 'My message is better than yours!',
);

in settings.php

SKAUGHT’s picture

removed. flashback, double post.

benjifisher’s picture

Status: Closed (won't fix) » Active

I am reopening this issue and marking #3179666: Inline Form Errors module advises that a failed login attempt with the wrong password is because of providing the wrong username. as a duplicate.

Even though the Inline Form Errors (IEF) module is disabled by default, it would be nice to solve the problem here even when IEF is enabled.

One suggestion from #3179666: Inline Form Errors module advises that a failed login attempt with the wrong password is because of providing the wrong username.:

As there are only two fields I wonder if the login form is a case where we should just disable inline form errors entirely via #2856950: Add a possibility to disable inline form errors for a complete form

We discussed these issues at #3186531: Drupal Usability Meeting 2020-12-11. We identified two problems with notifications that we might want to address, but not as part of this issue:

  1. Drupal puts all status messages in the same place (usually at the top of the screen). This is appropriate for site errors, but it is confusing to put user errors in the same place.
  2. The problem in this issue is similar to one we discussed in #2895055: Edit the date range error messages. With the login form and with datetime rage fields, there are two related fields. There is no way to decide which one has the invalid input, but the IEF module picks one. (I think it picks the first one on the form.) This can be confusing.

For this issue, we agreed that disabling IEF for the login form is a good step to take.

benjifisher’s picture

Version: 8.0.x-dev » 9.2.x-dev
MrPaulDriver’s picture

Issue tags: +Bug Smash Initiative

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.

smustgrave’s picture

Status: Active » Closed (cannot reproduce)

Closing as cannot reproduce

In Drupal 9.5 when using a wrong username/password combo I get

Unrecognized username or password. Forgot your password? which seems pretty clear.

If this is still an issue please reopen maybe with an updated issue summary, screenshots, etc.

Thanks!

Driskell’s picture

Status: Closed (cannot reproduce) » Active

@smusgrave

Closing as cannot reproduce

In Drupal 9.5 when using a wrong username/password combo I get

Unrecognized username or password. Forgot your password? which seems pretty clear.

If this is still an issue please reopen maybe with an updated issue summary, screenshots, etc.

The Inline Form Errors core module needs to be enabled to reproduce. The fix recommended was to disable this modules functionality from applying to the login form so that even when the module is enabled you see the default messaging.

I’ll reopen.

smustgrave’s picture

Thanks. Sounds like it will need an issue summary update to be more clear.

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.

DMRupp’s picture

Issue summary: View changes
DMRupp’s picture

I removed "Needs issue summary update" because I added the detail that the inline forms error module must be enabled to recreate this issue. This is still occuring on core 9.5.9.

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.

mlncn’s picture

Priority: Normal » Major
Issue summary: View changes
Status: Active » Needs review
Issue tags: +Needs reroll

Bumping this to major because the message:

> 1 error has been found: Username

occurs when people enter an incorrect password, also, and that stops most people from trying a different password or trying to reset their password.

mlncn’s picture

Status: Needs review » Needs work

welly made their first commit to this issue’s fork.

welly’s picture

Status: Needs work » Needs review

Can confirm patch at #11 resolves the described issue. Have rerolled for 11.x

welly’s picture

Issue tags: -Needs reroll

(Removed "Needs reroll" tag)

welly’s picture

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Seems test coverage is lost

welly’s picture

Cheers @smustgrave, will get that fixed 👍