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

@@ -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,