From 6cca332e0aad6a37baa491bde880ea238ebd502e Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Sat, 24 Jan 2026 23:48:46 -0500 Subject: [PATCH] Fix admin password reset to use Better Auth hashing --- backend/src/routes/auth.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/routes/auth.ts b/backend/src/routes/auth.ts index e77c733e..f30b728b 100644 --- a/backend/src/routes/auth.ts +++ b/backend/src/routes/auth.ts @@ -3,6 +3,7 @@ import type { AuthInstance } from '../auth' import { Database } from 'bun:sqlite' import { ENV } from '@opencode-manager/shared/config/env' import { logger } from '../utils/logger' +import { hashPassword } from 'better-auth/crypto' export function createAuthRoutes(auth: AuthInstance, _db: Database) { const app = new Hono() @@ -38,10 +39,7 @@ export async function syncAdminFromEnv(auth: AuthInstance, db: Database): Promis if (existingUser) { if (ENV.AUTH.ADMIN_PASSWORD_RESET) { - const hashedPassword = await Bun.password.hash(adminPassword, { - algorithm: 'bcrypt', - cost: 10, - }) + const hashedPassword = await hashPassword(adminPassword) db.prepare('UPDATE "account" SET password = ? WHERE "userId" = ? AND "providerId" = ?').run( hashedPassword, existingUser.id,