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.

blacklisted some emails + free link shorteners

Steven Tey2c423ec307a7
diff --git a/lib/constants/blacklist.ts b/lib/constants/blacklist.ts
index 246ef6a0b9..352e679a16 100644
--- a/lib/constants/blacklist.ts
+++ b/lib/constants/blacklist.ts
@@ -10,6 +10,9 @@
const BLACKLIST = new Set([
"lopescarvalho.adv.br",
+ "gruppopiueuroparegionelazio.it",
+ "rb.gy",
+ "in.sv",
"piracynchill.in",
"tgnewstv.it",
"secure.oldschool.com-os.cz",
diff --git a/lib/constants/blacklisted-emails.ts b/lib/constants/blacklisted-emails.ts
new file mode 100644
index 0000000000..ca63a9a7c5
--- /dev/null
+++ b/lib/constants/blacklisted-emails.ts
@@ -0,0 +1,10 @@
+const BLACKLISTED_EMAILS = new Set([
+ "mailto:[email protected]",
+]);
+
+export default BLACKLISTED_EMAILS;
diff --git a/lib/constants/index.ts b/lib/constants/index.ts
index 7e495520bc..cf98a5bba1 100644
--- a/lib/constants/index.ts
+++ b/lib/constants/index.ts
@@ -43,3 +43,4 @@ export const SPECIAL_APEX_DOMAINS = {
};
export { default as BLACKLIST } from "./blacklist";
+export { default as BLACKLISTED_EMAILS } from "./blacklisted-emails";
diff --git a/pages/api/auth/[...nextauth].tsx b/pages/api/auth/[...nextauth].tsx
index f875116e94..eff76434fa 100644
--- a/pages/api/auth/[...nextauth].tsx
+++ b/pages/api/auth/[...nextauth].tsx
@@ -5,6 +5,7 @@ import WelcomeEmail from "emails/WelcomeEmail";
import NextAuth, { type NextAuthOptions } from "next-auth";
import EmailProvider from "next-auth/providers/email";
import prisma from "@/lib/prisma";
+import { BLACKLISTED_EMAILS } from "@/lib/constants";
const VERCEL_DEPLOYMENT = !!process.env.VERCEL_URL;
@@ -36,6 +37,12 @@ export const authOptions: NextAuthOptions = {
},
},
callbacks: {
+ signIn: async ({ user }) => {
+ if (BLACKLISTED_EMAILS.has(user.email)) {
+ return false;
+ }
+ return true;
+ },
session: async ({ session, token }) => {
session.user = {
// @ts-ignore