@@ -245,10 +250,18 @@ function VerificationFormFallback() {
)
}
-export function VerifyContent({ hasEmailService, isProduction }: VerifyContentProps) {
+export function VerifyContent({
+ hasEmailService,
+ isProduction,
+ isEmailVerificationEnabled,
+}: VerifyContentProps) {
return (
}>
-
+
)
}
diff --git a/apps/sim/lib/auth.ts b/apps/sim/lib/auth.ts
index 6d57f54fa..82cd29c30 100644
--- a/apps/sim/lib/auth.ts
+++ b/apps/sim/lib/auth.ts
@@ -32,11 +32,11 @@ import {
handleInvoicePaymentFailed,
handleInvoicePaymentSucceeded,
} from '@/lib/billing/webhooks/invoices'
-import { hasEmailService, sendEmail } from '@/lib/email/mailer'
+import { sendEmail } from '@/lib/email/mailer'
import { getFromEmailAddress } from '@/lib/email/utils'
import { quickValidateEmail } from '@/lib/email/validation'
import { env, isTruthy } from '@/lib/env'
-import { isBillingEnabled, isProd } from '@/lib/environment'
+import { isBillingEnabled, isEmailVerificationEnabled } from '@/lib/environment'
import { createLogger } from '@/lib/logs/console/logger'
const logger = createLogger('Auth')
@@ -165,7 +165,7 @@ export const auth = betterAuth({
},
emailAndPassword: {
enabled: true,
- requireEmailVerification: isProd && hasEmailService(),
+ requireEmailVerification: isEmailVerificationEnabled,
sendVerificationOnSignUp: false,
throwOnMissingCredentials: true,
throwOnInvalidCredentials: true,
@@ -240,8 +240,8 @@ export const auth = betterAuth({
otp: string
type: 'sign-in' | 'email-verification' | 'forget-password'
}) => {
- if (!isProd) {
- logger.info('Skipping email verification in dev/docker')
+ if (!isEmailVerificationEnabled) {
+ logger.info('Skipping email verification')
return
}
try {
diff --git a/apps/sim/lib/env.ts b/apps/sim/lib/env.ts
index d3e94c5e6..832ad9cf9 100644
--- a/apps/sim/lib/env.ts
+++ b/apps/sim/lib/env.ts
@@ -51,6 +51,7 @@ export const env = createEnv({
BILLING_ENABLED: z.boolean().optional(), // Enable billing enforcement and usage tracking
// Email & Communication
+ EMAIL_VERIFICATION_ENABLED: z.boolean().optional(), // Enable email verification for user registration and login (defaults to false)
RESEND_API_KEY: z.string().min(1).optional(), // Resend API key for transactional emails
FROM_EMAIL_ADDRESS: z.string().min(1).optional(), // Complete from address (e.g., "Sim " or "noreply@domain.com")
EMAIL_DOMAIN: z.string().min(1).optional(), // Domain for sending emails (fallback when FROM_EMAIL_ADDRESS not set)
diff --git a/apps/sim/lib/environment.ts b/apps/sim/lib/environment.ts
index eff95cd78..a74ab24eb 100644
--- a/apps/sim/lib/environment.ts
+++ b/apps/sim/lib/environment.ts
@@ -30,6 +30,11 @@ export const isHosted =
*/
export const isBillingEnabled = isTruthy(env.BILLING_ENABLED)
+/**
+ * Is email verification enabled
+ */
+export const isEmailVerificationEnabled = isTruthy(env.EMAIL_VERIFICATION_ENABLED)
+
/**
* Get cost multiplier based on environment
*/
diff --git a/helm/sim/examples/values-production.yaml b/helm/sim/examples/values-production.yaml
index a2df754aa..ac307b14a 100644
--- a/helm/sim/examples/values-production.yaml
+++ b/helm/sim/examples/values-production.yaml
@@ -30,6 +30,9 @@ app:
BETTER_AUTH_SECRET: "your-production-auth-secret-here"
ENCRYPTION_KEY: "your-production-encryption-key-here"
+ # Email verification (set to true if you want to require email verification)
+ EMAIL_VERIFICATION_ENABLED: "false"
+
# Optional third-party service integrations (configure as needed)
RESEND_API_KEY: "your-resend-api-key"
GOOGLE_CLIENT_ID: "your-google-client-id"
diff --git a/helm/sim/values.yaml b/helm/sim/values.yaml
index 90b6bd025..72b7a4832 100644
--- a/helm/sim/values.yaml
+++ b/helm/sim/values.yaml
@@ -65,6 +65,7 @@ app:
ENCRYPTION_KEY: "" # REQUIRED - set via --set flag or external secret manager
# Email & Communication
+ EMAIL_VERIFICATION_ENABLED: "false" # Enable email verification for user registration and login (defaults to false)
RESEND_API_KEY: "" # Resend API key for transactional emails
FROM_EMAIL_ADDRESS: "" # Complete from address (e.g., "Sim " or "DoNotReply@domain.com")
EMAIL_DOMAIN: "" # Domain for sending emails (fallback when FROM_EMAIL_ADDRESS not set)