From cad8817fed6892f3b4feaa090101bf1670fdb49d Mon Sep 17 00:00:00 2001 From: Nana K <73991180+topboyasante@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:08:52 +0000 Subject: [PATCH] feat: verify if user's email is disposable on sign up (#117) * fix: Corrected "Stuffs" to "Stuff" on the landing page * fix: Corrected "Stuffs" to "Stuff" on the landing page * fix: Corrected Success Messages on the dashbaord * feat: Added Verification to check disposable emails * Update apps/dashboard/src/routes/signup/+page.svelte Co-authored-by: Rotimi Best * Update apps/dashboard/src/routes/signup/+page.svelte Co-authored-by: Rotimi Best --------- Co-authored-by: Rotimi Best --- apps/dashboard/src/routes/signup/+page.svelte | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/dashboard/src/routes/signup/+page.svelte b/apps/dashboard/src/routes/signup/+page.svelte index 2d941dad..6cbc7dc1 100644 --- a/apps/dashboard/src/routes/signup/+page.svelte +++ b/apps/dashboard/src/routes/signup/+page.svelte @@ -14,6 +14,7 @@ import { profile } from '$lib/utils/store/user'; import { currentOrg } from '$lib/utils/store/org'; import { capturePosthogEvent } from '$lib/utils/services/posthog'; + import { snackbar } from '$lib/components/Snackbar/store'; let supabase = getSupabase(); let fields = Object.assign({}, SIGNUP_FIELDS); @@ -43,6 +44,21 @@ try { loading = true; + // Check if the email address is disposable + const emailCheck = await fetch('https://is-disposable-email.ephraimduncan68.workers.dev/', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ email: fields.email }) + }); + const emailCheckResponse = await emailCheck.json(); + + if (emailCheckResponse.isDisposable === true) { + snackbar.error('The email you provided is disposable'); + return; + } + const { data: { session }, error