Make WordPress Core

Opened 7 days ago

Closed 6 days ago

#64261 closed defect (bug) (worksforme)

Suggestion: Apply trim() to Username Field During Login

Reported by: dishmaria's profile dishmaria Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords: reporter-feedback
Focuses: Cc:

Description

Hi Team,

I would like to raise a small but important usability concern regarding the WordPress login process.

Currently, the username field in the login form does not automatically trim leading or trailing spaces. According to common coding standards and best practices, input trimming is recommended—especially for authentication fields—because users often enter accidental spaces on mobile or while copy–pasting.

As a result, even if the username and password are correct, the login attempt fails due to unintended whitespace. Implementing a simple trim() on the username field before validation would significantly improve user experience and reduce failed login attempts.

I kindly request the team to consider adding this enhancement in a future update.

Thank you for your attention and the great work you do for the community.

Change History (3)

#1 follow-up: @westonruter
7 days ago

  • Keywords reporter-feedback added

@dishmaria Thanks for reporting this. I just tried to reproduce this issue and I wasn't able. In a WordPress install with username "admin", I tried providing " admin ", and it it still logged me in. Do you see differently?

#2 in reply to: ↑ 1 @dishmaria
6 days ago

Replying to westonruter:

Thanks for checking this.

I tested it again on my side, and you’re right — the core WordPress login screen now trims the username automatically. Earlier, I was experiencing failed logins when accidental spaces were added, but it seems this behavior has been resolved in the current version.

It’s possible the issue was coming from a custom login form, plugin, or cached version of the login page on my setup.

Thank you for verifying and for the quick response.

Last edited 6 days ago by dishmaria (previous) (diff)

#3 @westonruter
6 days ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.