Skip to content

fix(authentication): 2FA naming, backup codes gate, wire UserCreateByUsername gRPC#1501

Merged
kkopanidis merged 2 commits into
mainfrom
fix/bug-batch-authentication
Jun 21, 2026
Merged

fix(authentication): 2FA naming, backup codes gate, wire UserCreateByUsername gRPC#1501
kkopanidis merged 2 commits into
mainfrom
fix/bug-batch-authentication

Conversation

@kkopanidis

@kkopanidis kkopanidis commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

SMS 2FA used inconsistent twoFaMethod values (phone vs sms), so enable/login flows could reject a valid method. Backup-code routes registered whenever the config object existed, ignoring enabled. UserCreateByUsername was declared in the proto but not registered on the gRPC service.

  • Normalize SMS 2FA to twoFaMethod: 'sms' across enable, beginTwoFa, login challenge, and admin defaults; migrate legacy phone values on startup.
  • Register /twoFa/generate and /twoFa/recover only when twoFa.backUpCodes.enabled is true.
  • Wire userCreateByUsername on the authentication gRPC service map.

Test plan

  • Enable SMS 2FA and run beginTwoFa — no "Invalid method" error
  • Full login with SMS 2FA (local → authorize → verify)
  • With twoFa.backUpCodes.enabled: false, backup routes are not registered
  • gRPC UserCreateByUsername creates a user

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other (please describe)

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the PR's description (e.g. fix #xxx, where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature

Other information:

…Username gRPC

Align SMS 2FA on canonical twoFaMethod `sms`, gate backup-code routes on
backUpCodes.enabled, register userCreateByUsername in the gRPC service map,
and migrate legacy `phone` values on startup.
@kkopanidis
kkopanidis merged commit 514f1f0 into main Jun 21, 2026
7 checks passed
@kkopanidis
kkopanidis deleted the fix/bug-batch-authentication branch June 21, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant