- Fix MFA detection logic to recognize mfa_code_required error
- Remove strict mfaToken requirement when needMfa is determined by error code
- Update mfa/status route to use async getAuthUrl() from runtime-loader
- Update mfa/verify route to use async getAuthUrl() from runtime-loader
- Add comprehensive structured logging across all MFA endpoints
- Add timeout control (10s) for backend requests
- Improve error handling with detailed console output
- Add LOGIN_FLOW.md documentation in Chinese
This completes the migration of all MFA-related endpoints to the new Deno
native runtime configuration system.
- Create islands/UserMenu.tsx with self-contained user menu functionality
- Refactor islands/Navbar.tsx to use UserMenu component
- Support both desktop and mobile layouts with single component
API Routes Migration:
- Migrated /api/auth/mfa/status endpoint for checking MFA status
- Migrated /api/auth/mfa/setup endpoint for TOTP provisioning
- Migrated /api/auth/mfa/verify endpoint for code verification
- Migrated /api/auth/mfa/disable endpoint for disabling MFA
- All routes properly handle cookies (session and MFA tokens)
- Implemented proper error handling and status codes
Bug Fixes:
- Added favicon.ico to static folder (fixes 404 error)
- Updated fresh.gen.ts with new route manifests
Migration Details:
- Converted Next.js route handlers to Fresh Handlers pattern
- Updated cookie management from Next.js cookies() to Deno's getCookies()
- Changed Response handling from NextResponse to standard Response
- Maintained compatibility with existing authentication flow
- Proxies requests to backend account service API
- Panel Infrastructure:
- Add lib/userSession.ts for user session utilities
- Create islands/panel/Sidebar.tsx with navigation and MFA
warnings
- Create islands/panel/Header.tsx with user info and role badges
- Create islands/panel/PanelLayout.tsx as layout wrapper
- Add routes/panel/index.tsx as dashboard home page
- Add routes/panel/account.tsx for account settings
- Add routes/panel/mail.tsx for mail service (placeholder)
- Migrate /components/auth/AuthLayout.tsx to Preact
- Create /routes/login.tsx using Fresh handlers and SSR
- Create /islands/LoginForm.tsx with MFA (TOTP) support