mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Add single-user authentication system with Better Auth integration (#76)
* Add Better Auth integration with session management - Implement user authentication using Better Auth library - Add login, register, and sign out functionality - Support passkey/WebAuthn authentication - Create database schema for users, sessions, accounts, passkeys - Add AuthProvider context and ProtectedRoute components - Add account settings page in settings dialog - Protect all API routes with authentication middleware - Update environment configuration for auth providers * Add single-user authentication system with admin setup - Add first-run Setup page for initial admin account creation - Add environment-based admin configuration (ADMIN_EMAIL, ADMIN_PASSWORD) - Add password reset capability via ADMIN_PASSWORD_RESET environment flag - Migrate to data routers with auth loaders, remove ProtectedRoute - Add change password functionality to account settings - Enforce AUTH_SECRET requirement in production - Auto-disable registration when admin is pre-configured via environment * Track busy/idle session status across hooks * Bump version to 0.7.5 * Update pnpm to 10.28.1
This commit is contained in:
1 parent
af292758c3
commit
81a66d2ddb
29 files changed
+2324
-149
No files matched your search
@@ -4,9 +4,10 @@ import { GitSettings } from '@/components/settings/GitSettings'
|
||||
import { KeyboardShortcuts } from '@/components/settings/KeyboardShortcuts'
|
||||
import { OpenCodeConfigManager } from '@/components/settings/OpenCodeConfigManager'
|
||||
import { ProviderSettings } from '@/components/settings/ProviderSettings'
|
||||
import { AccountSettings } from '@/components/settings/AccountSettings'
|
||||
import { Dialog, DialogContent } from '@/components/ui/dialog'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import { Settings2, Keyboard, Code, ChevronLeft, X, Key, GitBranch } from 'lucide-react'
|
||||
import { Settings2, Keyboard, Code, ChevronLeft, X, Key, GitBranch, User } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useSwipeBack } from '@/hooks/useMobile'
|
||||
|
||||
@@ -15,7 +16,7 @@ interface SettingsDialogProps {
|
||||
onOpenChange: (open: boolean) => void
|
||||
}
|
||||
|
||||
type SettingsView = 'menu' | 'general' | 'git' | 'shortcuts' | 'opencode' | 'providers'
|
||||
type SettingsView = 'menu' | 'general' | 'git' | 'shortcuts' | 'opencode' | 'providers' | 'account'
|
||||
|
||||
export function SettingsDialog({ open, onOpenChange }: SettingsDialogProps) {
|
||||
const [mobileView, setMobileView] = useState<SettingsView>('menu')
|
||||
@@ -39,6 +40,7 @@ export function SettingsDialog({ open, onOpenChange }: SettingsDialogProps) {
|
||||
}, [bindSwipe])
|
||||
|
||||
const menuItems = [
|
||||
{ id: 'account', icon: User, label: 'Account', description: 'Profile, passkeys, and sign out' },
|
||||
{ id: 'general', icon: Settings2, label: 'General Settings', description: 'App preferences and behavior' },
|
||||
{ id: 'git', icon: GitBranch, label: 'Git', description: 'Git identity and credentials for repositories' },
|
||||
{ id: 'shortcuts', icon: Keyboard, label: 'Keyboard Shortcuts', description: 'Customize keyboard shortcuts' },
|
||||
@@ -65,9 +67,12 @@ export function SettingsDialog({ open, onOpenChange }: SettingsDialogProps) {
|
||||
Settings
|
||||
</h2>
|
||||
</div>
|
||||
<Tabs defaultValue="general" className="w-full flex flex-col flex-1 min-h-0">
|
||||
<Tabs defaultValue="account" className="w-full flex flex-col flex-1 min-h-0">
|
||||
<div className="px-6 pt-6 pb-4 flex-shrink-0">
|
||||
<TabsList className="grid w-full grid-cols-5 bg-card border border-border p-1">
|
||||
<TabsList className="grid w-full grid-cols-6 bg-card p-1">
|
||||
<TabsTrigger value="account" className="data-[state=active]:bg-blue-600 data-[state=active]:text-white text-muted-foreground transition-all duration-200">
|
||||
Account
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="general" className="data-[state=active]:bg-blue-600 data-[state=active]:text-white text-muted-foreground transition-all duration-200">
|
||||
General
|
||||
</TabsTrigger>
|
||||
@@ -88,6 +93,7 @@ export function SettingsDialog({ open, onOpenChange }: SettingsDialogProps) {
|
||||
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<div className="px-6 pb-6">
|
||||
<TabsContent value="account" className="mt-0"><AccountSettings /></TabsContent>
|
||||
<TabsContent value="general" className="mt-0"><GeneralSettings /></TabsContent>
|
||||
<TabsContent value="git" className="mt-0"><GitSettings /></TabsContent>
|
||||
<TabsContent value="shortcuts" className="mt-0"><KeyboardShortcuts /></TabsContent>
|
||||
@@ -148,6 +154,7 @@ export function SettingsDialog({ open, onOpenChange }: SettingsDialogProps) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{mobileView === 'account' && <AccountSettings />}
|
||||
{mobileView === 'general' && <GeneralSettings />}
|
||||
{mobileView === 'git' && <GitSettings />}
|
||||
{mobileView === 'shortcuts' && <KeyboardShortcuts />}
|
||||
|
||||
Reference in new issue
Block a user