mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: trusted url missing, better auth crash due to update (#240)
* fix: release.yml * fix: S3ChannelConfigSchema type port mismatch * chore: package.json * fix: refactoring logs and adding pino logger for production and dev. * fix: trusted url error due to better auth update. --------- Co-authored-by: charlesgauthereau <charles.gauthereau@soluce-technologies.com> Co-authored-by: killianlarcher <killian.larcher@soluce-technologies.com>
This commit is contained in:
co-authored by
charlesgauthereau
killianlarcher
parent
203c25aabe
commit
dd85f7a25d
@@ -58,3 +58,6 @@ AUTH_PASSKEY_ENABLED=true
|
||||
|
||||
# Retention
|
||||
RETENTION_CRON="* * * * *"
|
||||
|
||||
TRUSTED_DOMAINS="http://localhost:8887, http://localhost:3055, http://localhost:3056"
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ export function SocialAuthButtons({ providers }: { providers: AuthProviderConfig
|
||||
providerType: "oidc",
|
||||
callbackURL: "/dashboard",
|
||||
});
|
||||
console.log(result);
|
||||
} else {
|
||||
result = await authClient.signIn.social({
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
@@ -20,6 +20,8 @@ export const env = createEnv({
|
||||
.regex(/^https?:\/\//, "URL must start with http:// or https://"),
|
||||
PROJECT_SECRET: z.string(),
|
||||
|
||||
TRUSTED_DOMAINS: z.string().optional(),
|
||||
|
||||
SMTP_PASSWORD: z.string().optional(),
|
||||
SMTP_FROM: z.string().optional(),
|
||||
SMTP_HOST: z.string().optional(),
|
||||
@@ -101,6 +103,8 @@ export const env = createEnv({
|
||||
|
||||
DATABASE_URL: process.env.DATABASE_URL,
|
||||
|
||||
TRUSTED_DOMAINS: process.env.TRUSTED_DOMAINS,
|
||||
|
||||
SMTP_PASSWORD: process.env.SMTP_PASSWORD,
|
||||
SMTP_FROM: process.env.SMTP_FROM,
|
||||
SMTP_HOST: process.env.SMTP_HOST,
|
||||
|
||||
+19
-1
@@ -516,9 +516,27 @@ export const auth = betterAuth({
|
||||
},
|
||||
},
|
||||
},*/
|
||||
trustedOrigins: [env.PROJECT_URL!, "http://app"],
|
||||
// trustedOrigins: [env.PROJECT_URL!, "http://app"],
|
||||
trustedOrigins: async (request) => {
|
||||
const trustedOrigins = await queryTrustedDomains();
|
||||
return trustedOrigins;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const queryTrustedDomains = async (): Promise<string[]> => {
|
||||
const envDomains = env.TRUSTED_DOMAINS || "";
|
||||
const domains = envDomains
|
||||
.split(",")
|
||||
.map((d) => d.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
if (env.PROJECT_URL) domains.push(env.PROJECT_URL);
|
||||
domains.push("http://app")
|
||||
|
||||
return domains;
|
||||
};
|
||||
|
||||
/*export const signUpUser = async (email: string, password: string, name: string) => {
|
||||
const user = await auth.api.signUpEmail({
|
||||
body: {
|
||||
|
||||
Reference in New Issue
Block a user