@@ -192,7 +192,7 @@ function VerificationForm({
{isLoading ? 'Verifying...' : 'Verify Email'}
- {hasResendKey && (
+ {hasEmailService && (
Didn't receive a code?{' '}
@@ -245,10 +245,10 @@ function VerificationFormFallback() {
)
}
-export function VerifyContent({ hasResendKey, isProduction }: VerifyContentProps) {
+export function VerifyContent({ hasEmailService, isProduction }: VerifyContentProps) {
return (
}>
-
+
)
}
diff --git a/apps/sim/lib/auth.ts b/apps/sim/lib/auth.ts
index e5183db575..3e0b1f0064 100644
--- a/apps/sim/lib/auth.ts
+++ b/apps/sim/lib/auth.ts
@@ -32,7 +32,7 @@ import {
handleInvoicePaymentFailed,
handleInvoicePaymentSucceeded,
} from '@/lib/billing/webhooks/invoices'
-import { sendEmail } from '@/lib/email/mailer'
+import { hasEmailService, sendEmail } from '@/lib/email/mailer'
import { getFromEmailAddress } from '@/lib/email/utils'
import { quickValidateEmail } from '@/lib/email/validation'
import { env, isTruthy } from '@/lib/env'
@@ -147,7 +147,7 @@ export const auth = betterAuth({
},
emailAndPassword: {
enabled: true,
- requireEmailVerification: isProd,
+ requireEmailVerification: isProd && hasEmailService(),
sendVerificationOnSignUp: false,
throwOnMissingCredentials: true,
throwOnInvalidCredentials: true,
diff --git a/apps/sim/lib/email/mailer.ts b/apps/sim/lib/email/mailer.ts
index 9b12f2d7b1..ab35acc349 100644
--- a/apps/sim/lib/email/mailer.ts
+++ b/apps/sim/lib/email/mailer.ts
@@ -69,6 +69,13 @@ const azureEmailClient =
? new EmailClient(azureConnectionString)
: null
+/**
+ * Check if any email service is configured and available
+ */
+export function hasEmailService(): boolean {
+ return !!(resend || azureEmailClient)
+}
+
export async function sendEmail(options: EmailOptions): Promise {
try {
// Check if user has unsubscribed (skip for critical transactional emails)
diff --git a/docker-compose.local.yml b/docker-compose.local.yml
index ad42a55e67..768c0cc706 100644
--- a/docker-compose.local.yml
+++ b/docker-compose.local.yml
@@ -10,6 +10,7 @@ services:
limits:
memory: 8G
environment:
+ - NODE_ENV=development
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-simstudio}
- BETTER_AUTH_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
- NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 3c3d6f82e2..c6b79e6c1e 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -9,6 +9,7 @@ services:
limits:
memory: 8G
environment:
+ - NODE_ENV=production
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-simstudio}
- BETTER_AUTH_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
- NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL:-http://localhost:3000}