Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix edge config

Steven Tey3a6bbeee9d19
diff --git a/.github/workflows/prettier.yaml b/.github/workflows/prettier.yaml
index 1fa1ec24bf..d04fb108c0 100644
--- a/.github/workflows/prettier.yaml
+++ b/.github/workflows/prettier.yaml
@@ -24,5 +24,8 @@ jobs:
- name: Install dependencies
run: pnpm install
+ - name: Fix prettier issues
+ run: pnpm run format
+
- name: Check prettier format
run: pnpm run prettier-check
diff --git a/apps/web/lib/actions/send-otp.ts b/apps/web/lib/actions/send-otp.ts
index e171bd3f3b..8e0f1ac9cd 100644
--- a/apps/web/lib/actions/send-otp.ts
+++ b/apps/web/lib/actions/send-otp.ts
@@ -43,29 +43,31 @@ export const sendOtpAction = actionClient
const domain = email.split("@")[1];
- const [isDisposable, emailDomainTerms] = await Promise.all([
- redis.sismember("disposableEmailDomains", domain),
- get("emailDomainTerms"),
- ]);
-
- if (isDisposable) {
- throw new Error(
- "Invalid email address – please use your work email instead. If you think this is a mistake, please contact us at [email protected]",
- );
- }
+ if (process.env.NEXT_PUBLIC_IS_DUB) {
+ const [isDisposable, emailDomainTerms] = await Promise.all([
+ redis.sismember("disposableEmailDomains", domain),
+ process.env.EDGE_CONFIG ? get("emailDomainTerms") : [],
+ ]);
- if (emailDomainTerms && Array.isArray(emailDomainTerms)) {
- const blacklistedEmailDomainTermsRegex = new RegExp(
- emailDomainTerms
- .map((term: string) => term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) // replace special characters with escape sequences
- .join("|"),
- );
-
- if (blacklistedEmailDomainTermsRegex.test(domain)) {
+ if (isDisposable) {
throw new Error(
"Invalid email address – please use your work email instead. If you think this is a mistake, please contact us at [email protected]",
);
}
+
+ if (emailDomainTerms && Array.isArray(emailDomainTerms)) {
+ const blacklistedEmailDomainTermsRegex = new RegExp(
+ emailDomainTerms
+ .map((term: string) => term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) // replace special characters with escape sequences
+ .join("|"),
+ );
+
+ if (blacklistedEmailDomainTermsRegex.test(domain)) {
+ throw new Error(
+ "Invalid email address – please use your work email instead. If you think this is a mistake, please contact us at [email protected]",
+ );
+ }
+ }
}
const code = generateOTP();