mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
refactor(auth): simplify trustedOrigins logic by removing redundant admin check and using optional chaining for settings access
This commit is contained in:
@@ -38,24 +38,14 @@ const { handler, api } = betterAuth({
|
||||
},
|
||||
...(!IS_CLOUD && {
|
||||
async trustedOrigins() {
|
||||
const admin = await db.query.member.findFirst({
|
||||
where: eq(schema.member.role, "owner"),
|
||||
with: {
|
||||
user: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (admin?.user) {
|
||||
const settings = await getWebServerSettings();
|
||||
if (!settings) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
...(settings.serverIp ? [`http://${settings.serverIp}:3000`] : []),
|
||||
...(settings.host ? [`https://${settings.host}`] : []),
|
||||
];
|
||||
const settings = await getWebServerSettings();
|
||||
if (!settings) {
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
return [
|
||||
...(settings?.serverIp ? [`http://${settings?.serverIp}:3000`] : []),
|
||||
...(settings?.host ? [`https://${settings?.host}`] : []),
|
||||
];
|
||||
},
|
||||
}),
|
||||
emailVerification: {
|
||||
|
||||
Reference in New Issue
Block a user