mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(auth): remove ssl enforcement in prod for supabase db
This commit is contained in:
@@ -8,6 +8,5 @@ const connectionString = process.env.POSTGRES_URL || process.env.DATABASE_URL!
|
||||
// Disable prefetch as it is not supported for "Transaction" pool mode
|
||||
const client = postgres(connectionString, {
|
||||
prepare: false,
|
||||
ssl: process.env.NODE_ENV === 'production',
|
||||
})
|
||||
export const db = drizzle(client)
|
||||
|
||||
+22
-13
@@ -25,19 +25,6 @@ export const auth = betterAuth({
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
requireEmailVerification: true,
|
||||
sendVerificationEmail: async ({ user, url }: EmailHandler) => {
|
||||
await resend.emails.send({
|
||||
from: 'Sim Studio <onboarding@simstudio.ai>',
|
||||
to: user.email,
|
||||
subject: 'Verify your email',
|
||||
html: `
|
||||
<h2>Welcome to Sim Studio!</h2>
|
||||
<p>Click the link below to verify your email:</p>
|
||||
<a href="${url}">${url}</a>
|
||||
<p>If you didn't create an account, you can safely ignore this email.</p>
|
||||
`,
|
||||
})
|
||||
},
|
||||
sendResetPassword: async ({ user, url }: EmailHandler) => {
|
||||
await resend.emails.send({
|
||||
from: 'Sim Studio <team@simstudio.ai>',
|
||||
@@ -52,6 +39,28 @@ export const auth = betterAuth({
|
||||
})
|
||||
},
|
||||
},
|
||||
emailVerification: {
|
||||
sendVerificationEmail: async ({ user, url }: EmailHandler) => {
|
||||
console.log('Attempting to send verification email to:', user.email)
|
||||
console.log('Verification URL:', url)
|
||||
try {
|
||||
const result = await resend.emails.send({
|
||||
from: 'Sim Studio <onboarding@simstudio.ai>',
|
||||
to: user.email,
|
||||
subject: 'Verify your email',
|
||||
html: `
|
||||
<h2>Welcome to Sim Studio!</h2>
|
||||
<p>Click the link below to verify your email:</p>
|
||||
<a href="${url}">${url}</a>
|
||||
<p>If you didn't create an account, you can safely ignore this email.</p>
|
||||
`,
|
||||
})
|
||||
console.log('Resend API response:', result)
|
||||
} catch (error) {
|
||||
console.error('Error sending verification email:', error)
|
||||
}
|
||||
},
|
||||
},
|
||||
socialProviders: {
|
||||
github: {
|
||||
clientId: process.env.GITHUB_CLIENT_ID!,
|
||||
|
||||
Reference in New Issue
Block a user