mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-11-26 16:01:21 +00:00
feat(auth): 2FA with an authenticator app (#552) Accounts with a password can turn on 2FA from the account menu. Setup asks for the password, shows a QR code and the key to type by hand, checks one code from the app, then shows ten backup codes to copy or download. Login with a password then asks for the app's code or a backup code, with an opt-in "trust this device for 30 days". When 2FA is on, the menu shows On and opens Manage 2FA for new backup codes or turning it off. Built on Better Auth's twoFactor plugin: migration 0025 adds users.two_factor_enabled and the two_factors table. The plugin only gates /sign-in/email, so SSO, header auth and API keys are unchanged. It is listed before oauthProvider so a password alone never mints an OAuth authorization code; tests fail if the order is swapped. bun run disable-2fa -- --email=... turns it off for someone who lost both the phone and the backup codes, and forgets trusted browsers. Also fixes a race in the login form: it always sent the browser to the dashboard after one second, which cut off an app signing in through Gitea Mirror when its callback or the consent page took longer than that.
docs/
User documentation lives on the website: gitea-mirror.raylabs.io/docs, with its sources in www/src/pages/docs/. Change those pages when behavior changes.
This folder holds notes for maintainers and contributors:
- DEVELOPMENT_WORKFLOW.md: local setup, commands, tests, type checking and releases.
- SHUTDOWN_AND_RECOVERY.md: signals, stop timeouts, job recovery and the related scripts.
- NIX_DISTRIBUTION.md: the Nix flake,
bun.nixand the Nix CI. - SSO_TESTING.md: testing SSO sign-in locally against Google, Keycloak or a mock provider.
The other files here are short pointers to the website, kept so old links keep working.
See also CONTRIBUTING.md and CLAUDE.md in the repository root.