QR-code 2FA setup and consolidated account settings#132
Conversation
Add a scannable QR code to the two-factor authentication enrollment flow and move account security settings into the main Settings screen. - Render the server's otpauth URI as a QR code (qr_flutter, already a dependency) in the 2FA setup, on a white quiet-zone background so it scans regardless of theme. The secret stays as copyable text with a copy button for manual entry as a fallback. - Add a "Password & Security" tile to Settings → Account (password, two-factor authentication, delete account), consolidating account management where all other profile settings already live. - Remove the "Account settings" item from the avatar/status popup so that button is now a pure status picker. Retitle the dialog to "Password & Security" to match its new entry point. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Extract bare TOTP secret from otpauth URI via extractTotpSecret() so the SelectableText and copy button show/copy the secret alone instead of the raw URI when the server omits the 'secret' field. - Raise QR error-correction from L (7%) to M (15%) for better on-screen scan reliability. - Add maxLength:6, textInputAction.done, and onSubmitted to the TOTP code field so the keyboard can submit the form directly. - Add unit tests for extractTotpSecret() covering null, full URI, param order, case-insensitivity, and plain-secret pass-through. https://claude.ai/code/session_012AcX8kWnAu6oh4tQRiYkg6
Code Review — PR #132Reviewed 🟡 Medium — Copy button copies raw
|
What changed
Two related account/security UX improvements.
1. QR-code 2FA enrollment
The 2FA setup previously showed only the TOTP secret as plain text, forcing users to type it into their authenticator app by hand. Now it renders the server's
otpauthURI as a scannable QR code (usingqr_flutter, already a dependency).2. Consolidated account settings
Account security (password, 2FA, delete account) was only reachable from a "Account settings" item buried in the avatar/status popup menu — separate from every other profile/account setting, which all live in Settings → Account.
New end-to-end path: Settings → Account → Password & Security → Enable 2FA → scan the QR code.
Why
Reviewer notes
qr_flutterwas already inpubspec.yaml/pubspec.lock.flutter analyze --no-fatal-infospasses clean on all three changed files.Files
lib/features/user/views/accord_account_settings.dart— QR code + copy button; dialog retitlelib/features/settings/views/accord_settings_screen.dart— "Password & Security" tilelib/features/user/components/self_status_button.dart— remove account item; status-picker only🤖 Generated with Claude Code