chore: update better-auth package to version 1.2.4 and kysely to version 0.27.6; enhance error handling in 2FA feature

This commit is contained in:
Mauricio Siu
2025-03-15 14:45:21 -06:00
parent c3a5e2a8d6
commit 6f7a5609a3
5 changed files with 49 additions and 28 deletions

View File

@@ -40,7 +40,7 @@
"@oslojs/encoding":"1.1.0",
"@oslojs/crypto":"1.0.1",
"drizzle-dbml-generator":"0.10.0",
"better-auth":"1.2.0",
"better-auth":"1.2.4",
"@faker-js/faker": "^8.4.1",
"@lucia-auth/adapter-drizzle": "1.0.7",
"@octokit/auth-app": "^6.0.4",

View File

@@ -28,6 +28,26 @@ const { handler, api } = betterAuth({
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
},
},
...(!IS_CLOUD && {
async trustedOrigins() {
const admin = await db.query.member.findFirst({
where: eq(schema.member.role, "owner"),
with: {
user: true,
},
});
if (admin) {
return [
...(admin.user.serverIp
? [`http://${admin.user.serverIp}:3000`]
: []),
...(admin.user.host ? [`https://${admin.user.host}`] : []),
];
}
return [];
},
}),
emailVerification: {
sendOnSignUp: true,
autoSignInAfterVerification: true,