feat: add two-factor authentication support and related configurations

This commit is contained in:
2026-07-24 12:59:10 +02:00
parent 54345e621c
commit 235d5f646c
27 changed files with 2608 additions and 374 deletions

View File

@@ -17,6 +17,7 @@ A starter template built with Laravel 13, Inertia.js v3, Vue 3, Nuxt UI, and Tai
- **Authentication** — Login (email or username), register, forgot/reset password
- **Social Login** — OAuth via Laravel Socialite with provider tracking (`social_accounts` table)
- **Email Verification** — Optional, toggle via `AUTH_ENABLE_EMAIL_VERIFICATION`
- **Two-Factor Authentication** — Optional TOTP and recovery-code protection, toggle via `AUTH_ENABLE_TWO_FACTOR`
- **Dashboard** — Protected page using Nuxt UI dashboard components with `auth` + `verified` middleware
- **Security** — Nullable passwords for social-only users, verified-email requirement for provider linking, rate limiting on all auth endpoints
- **Code Quality** — ESLint, Laravel Pint, shared Valibot validation schemas
@@ -73,6 +74,8 @@ AUTH_ENABLE_REGISTRATION=true
AUTH_ENABLE_PASSWORD_RESET=true
AUTH_ENABLE_REMEMBER_ME=true
AUTH_ENABLE_EMAIL_VERIFICATION=false
AUTH_ENABLE_TWO_FACTOR=false
AUTH_REQUIRE_TWO_FACTOR=false
AUTH_REDIRECT_LOGIN=/dashboard
AUTH_REDIRECT_LOGOUT=/
@@ -85,6 +88,16 @@ When `AUTH_ENABLE_EMAIL_VERIFICATION=true`:
- Social login users are auto-verified (trusted from provider)
- Social accounts can only be linked to users with verified emails
When `AUTH_ENABLE_TWO_FACTOR=true`, authenticated users can enroll an authenticator
and manage recovery codes from `/profile`. Existing password and social logins are
both held at the two-factor challenge until a valid TOTP or one-time recovery code is
provided.
Set both `AUTH_ENABLE_TWO_FACTOR=true` and `AUTH_REQUIRE_TWO_FACTOR=true` to
require every authenticated user to complete enrollment before accessing
protected web pages or authenticated API endpoints. Enrollment, email
verification, and logout routes remain available while setup is pending.
See `config/auth-ui.php` for all available options including page titles, icons, legal links, and social provider configuration.
## Social Login Setup