Page MenuHomePhabricator

2FA removal UI displays incorrect message about recovery codes
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Have more than one authenticator app enrolled
  • In Special:Accountsecurity, click the option to disable one of your authenticator apps

What happens?:

  • The UI displays the message (oathauth-delete-warning): "You won't be able to use this authentication method to log in anymore and your recovery codes will no longer work"

What should have happened instead?:

Other information (browser name/version, screenshots, etc.):

T405872

Screenshot from 2025-11-21 14-42-01.png (555×1 px, 46 KB)

Event Timeline

Playing around with this a bit locally, I think we either need to change the copy for the oathauth-delete-warning message or introduce a different code path/message. Because the code appears to be working properly in recognizing existing/remaining auth app keys. When I inspect $lastKey, $this->isPrivilegedUser() and even count( $remainingKeys ), all of those appear correct when I have 2+ auth app keys set for my account. But the only path the code can take in this case is rendering the oathauth-delete-warning message via: Html::element( 'p', [], $this->msg( 'oathauth-delete-warning' )->text() ) ); on line 641 of OATHManage.php.

In my test on jawiki, I found that deleting security key can also show this incorrect warning. FYR.

Change #1217316 had a related patch set uploaded (by Mstyles; author: Mstyles):

[mediawiki/extensions/OATHAuth@master] Delete passkeys when final 2FA method is deleted

https://gerrit.wikimedia.org/r/1217316

Change #1217316 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Delete passkeys when final 2FA method is deleted

https://gerrit.wikimedia.org/r/1217316