WordPress / WordPress/two-factor
Failed-attempt warning addresses two mutually exclusive audiences simultaneously
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 825
- Forks
- 187
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 17
Description
Problem
The notice shown after any failed 2FA attempt (class-two-factor-core.php lines 1027–1028):
WARNING: Your account has attempted to login %d times without providing a valid two factor token. The last failed login occurred %s ago. If this wasn't you, you should reset your password.
The message speaks to two mutually exclusive people at the same time:
- The legitimate account holder — addressed by "your account" and "you should reset your password"
- A hypothetical attacker reading the form — implied by "if this wasn't you"
In practice, the person reading this message is almost always the legitimate user, who just mistyped their verification code. Telling them "if this wasn't you, reset your password" in response to their own failed attempt is alarming and misleading. It implies they may have been compromised when the most likely explanation is a typo.
If the goal is to alert the user to unauthorized access attempts, the message should be specific about what that means and when it applies — not appended as a hedge to every failed attempt.
Impact
- Legitimate users who mistype their code are told to reset their password unnecessarily
- The dual-audience framing makes the message unclear to both audiences
- Affects all providers, not just email
Suggested direction
Separate the two concerns:
- Show the failure count and timestamp as informational context (no alarming language for the common case of a typo)
- Reserve the "reset your password" prompt for cases where the failure count or pattern actually suggests unauthorized access — or remove it from this message entirely and rely on the existing compromised-password reset flow
Related
Two_Factor_Core::maybe_show_last_login_failure_notice()Two_Factor_Core::should_reset_password()— the existing flow that handles the compromised-password case separately
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with class-two-factor-core.php at Two_Factor_Core::maybe_show_last_login_failure_notice() and compare it with Two_Factor_Core::should_reset_password(). Decide how the notice and existing compromised-password flow should be separated, then verify that failed-attempt context is shown without misleading legitimate users and that the reset flow remains responsible for compromised-password cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100