Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1421 expand spam email check to new_customer checkout step #1423

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading