Skip to content

Commit

Permalink
#1421 expand spam email check to new_customer checkout step
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsimpson committed Nov 11, 2024
1 parent 10a5fcb commit 351660c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion subscribie/blueprints/checkout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
SubscriptionNote,
Setting,
TaxRate,
SpamEmailDomain,
)
from subscribie.email import EmailMessageQueue
from subscribie.utils import (
Expand All @@ -45,7 +46,6 @@
signal_payment_failed,
signal_new_donation,
)
from subscribie.notifications import newSubscriberEmailNotification
import stripe
import backoff
import os
Expand All @@ -66,6 +66,15 @@ def donate_form():

@checkout.route("/new_customer", methods=["GET"])
def new_customer():
# Verify that shop owner email address is not
# a suspected SUSPECTED_SPAM_EMAIL_DOMAINS
user = User.query.first()
SUSPECTED_SPAM_EMAIL_DOMAINS = [d.domain for d in SpamEmailDomain.query.all()]
user_email_domain = user.email.split("@")[1]
if user_email_domain in SUSPECTED_SPAM_EMAIL_DOMAINS:
log.error(f"SUSPECTED_SPAM_EMAIL_DOMAIN {user.email} " "attempted to sign up")
return "<h1>Please contact support before signing-up, thank you.</h1>"

session["subscribie_checkout_session_id"] = str(uuid4())
plan = Plan.query.filter_by(uuid=request.args["plan"]).first()
if plan is None:
Expand Down

0 comments on commit 351660c

Please sign in to comment.