mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-17 09:25:20 +00:00
refactor(auth): streamline trusted origins configuration and improve readability
- Changed the export of the `handler` and `api` constants to local scope for better clarity. - Enhanced the trusted origins logic by restructuring the code for improved readability and maintainability. - Commented out the cloud environment redirection logic for future consideration, aligning with previous changes in the codebase.
This commit is contained in:
@@ -19,13 +19,13 @@ import { getHubSpotUTK, submitToHubSpot } from "../utils/tracking/hubspot";
|
|||||||
import { sendEmail } from "../verification/send-verification-email";
|
import { sendEmail } from "../verification/send-verification-email";
|
||||||
import { getPublicIpWithFallback } from "../wss/utils";
|
import { getPublicIpWithFallback } from "../wss/utils";
|
||||||
|
|
||||||
export const { handler, api } = betterAuth({
|
const { handler, api } = betterAuth({
|
||||||
database: drizzleAdapter(db, {
|
database: drizzleAdapter(db, {
|
||||||
provider: "pg",
|
provider: "pg",
|
||||||
schema: schema,
|
schema: schema,
|
||||||
}),
|
}),
|
||||||
disabledPaths: [
|
disabledPaths: [
|
||||||
// "/sso/register",
|
"/sso/register",
|
||||||
"/organization/create",
|
"/organization/create",
|
||||||
"/organization/update",
|
"/organization/update",
|
||||||
"/organization/delete",
|
"/organization/delete",
|
||||||
@@ -44,7 +44,7 @@ export const { handler, api } = betterAuth({
|
|||||||
logger: {
|
logger: {
|
||||||
disabled: process.env.NODE_ENV === "production",
|
disabled: process.env.NODE_ENV === "production",
|
||||||
},
|
},
|
||||||
// ...(!IS_CLOUD && {
|
...(!IS_CLOUD && {
|
||||||
async trustedOrigins() {
|
async trustedOrigins() {
|
||||||
const settings = await getWebServerSettings();
|
const settings = await getWebServerSettings();
|
||||||
if (!settings) {
|
if (!settings) {
|
||||||
@@ -70,9 +70,7 @@ export const { handler, api } = betterAuth({
|
|||||||
: []),
|
: []),
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
// Untrusted OIDC discovery URL: The main discovery endpoint "https://login.microsoftonline.com/9f26c287-38e9-4731-9d1d-506365a6cc8e/.well-known/openid-configuration" is not trusted by your trusted origins configuration.
|
}),
|
||||||
|
|
||||||
// }),
|
|
||||||
emailVerification: {
|
emailVerification: {
|
||||||
sendOnSignUp: true,
|
sendOnSignUp: true,
|
||||||
autoSignInAfterVerification: true,
|
autoSignInAfterVerification: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user