feat: improve account security

Support TOTP 2fa, allow for changing password, add session management
and account removal.
This commit is contained in:
Zoe
2026-10-08 12:43:22 -05:00
parent ff33e9c573
commit 4bba529ba8
27 changed files with 4874 additions and 468 deletions
+7
View File
@@ -1,6 +1,7 @@
import { drizzleAdapter } from "@better-auth/drizzle-adapter/relations-v2";
import { db } from "../server/lib/db";
import { betterAuth } from 'better-auth/minimal';
import { twoFactor } from 'better-auth/plugins/two-factor';
import * as schema from '../drizzle/schema';
export const auth = betterAuth({
@@ -22,6 +23,12 @@ export const auth = betterAuth({
baseURL: process.env.NUXT_PUBLIC_URL ?? 'http://localhost:3000',
trustedOrigins: [process.env.NUXT_PUBLIC_URL ?? 'http://localhost:3000'],
plugins: [
twoFactor({
issuer: 'Veridian',
}),
],
emailAndPassword: {
// if DISABLE_LOCAL_AUTH is set to "1" or "true" then local auth is disabled
enabled: process.env.DISABLE_LOCAL_AUTH?.toLowerCase() !== 'true' && process.env.DISABLE_LOCAL_AUTH !== '1',