BadRequestHttpException when user logs in (with incorrect password) using REST

Created on 20 December 2017, about 7 years ago
Updated 5 August 2024, 6 months ago

When a user logs in using REST (JSON endpoint): http://www.example.com/user/login?_format=json and provides an incorrect username and/or password, the login fails as it should. But in the Drupal log, a new entry is created:

Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Sorry, unrecognized username or password. in Drupal\user\Controller\UserAuthenticationController->login() (line 219 of UserAuthenticationController.php).

The problem is that the entry has a severity level of ERROR, but a failed login should be at most a WARNING.

We use REST JSON endpoint for a user login in our application and our logs are filled with ERROR severity entries and it is hard to find actual problems in a pool of login failed messages with too high severity.

I suggest lowering the severity level of this type of error logs. This wrong reporting can be a big problem for use cases similar to ours when a lot of logins is attempted via REST endpoints.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
User system 

Last updated 14 minutes ago

Created by

🇸🇮Slovenia KlemenDEV

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024