mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
refactor(auth): reset the admin and count users through the Better Auth adapter
The admin password reset and the first-user check read and wrote the Better Auth tables with raw SQL, so session delete hooks never ran on the reset path. - the admin is found with findUserByEmail and its credential account is updated by id with the configured password hasher - sessions are removed with deleteUserSessions, which runs the session delete hooks - a missing credential account logs a warning instead of updating nothing - /api/auth-info/config counts users through the adapter
This commit is contained in:
1 parent
b9d8d18124
commit
cbe4f7ed9e
4 files changed
+186
-131
No files matched your search
@@ -244,7 +244,7 @@ try {
|
||||
await gitAuthService.initialize(ipcServer, db)
|
||||
logger.info(`Git IPC server running at ${ipcServer.ipcHandlePath}`)
|
||||
|
||||
await syncAdminFromEnv(auth, db)
|
||||
await syncAdminFromEnv(auth)
|
||||
|
||||
opencodeServerManager.setDatabase(db)
|
||||
detectSandboxCapability()
|
||||
@@ -389,7 +389,7 @@ const previewSessionStore = new PreviewSessionStore()
|
||||
const previewAvailability = createPreviewAvailability(false)
|
||||
|
||||
app.route('/api/auth', createAuthRoutes(auth))
|
||||
app.route('/api/auth-info', createAuthInfoRoutes(auth, db))
|
||||
app.route('/api/auth-info', createAuthInfoRoutes(auth))
|
||||
app.route('/api/health', createHealthRoutes(db, openCodeSupervisor))
|
||||
|
||||
app.route('/api/mcp-oauth-proxy', createMcpOauthProxyRoutes(openCodeClient, requireAuth))
|
||||
|
||||
Reference in new issue
Block a user