diff --git a/.github/workflows/pr-demo-deploy.yml b/.github/workflows/pr-demo-deploy.yml index 01052084..04bc5830 100644 --- a/.github/workflows/pr-demo-deploy.yml +++ b/.github/workflows/pr-demo-deploy.yml @@ -124,7 +124,7 @@ jobs: cd tests/browser-automated-tests-playwright python3 run-playwright-tests.py - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: ${{ always() }} with: name: Screenshots-and-video-artifacts diff --git a/migrations/versions/abfb5c2f77e6_add_spamemaildomain.py b/migrations/versions/abfb5c2f77e6_add_spamemaildomain.py new file mode 100644 index 00000000..6e13a089 --- /dev/null +++ b/migrations/versions/abfb5c2f77e6_add_spamemaildomain.py @@ -0,0 +1,34 @@ +"""add SpamEmailDomain + +Revision ID: abfb5c2f77e6 +Revises: abc1ff0c85e0 +Create Date: 2024-11-11 21:27:48.094799 + +""" + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "abfb5c2f77e6" +down_revision = "abc1ff0c85e0" +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + "spam_email_domain", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("uuid", sa.String(), nullable=True), + sa.Column("ts", sa.DateTime(), nullable=True), + sa.Column("domain", sa.String(), nullable=True), + sa.Column("archived", sa.Boolean(), nullable=True), + sa.Column("created_at", sa.DateTime(), nullable=True), + sa.PrimaryKeyConstraint("id"), + ) + + +def downgrade(): + pass diff --git a/settings.yaml.example b/settings.yaml.example index d353ad9d..735f4451 100644 --- a/settings.yaml.example +++ b/settings.yaml.example @@ -74,7 +74,6 @@ SUPPORTED_CURRENCIES: "GBP,USD,EUR" # Anti spam ANTI_SPAM_SHOP_NAMES_MODEL_FULL_PATH: "/path/to/classifier.pkl" - # Optional TELEGRAM_TOKEN: TELEGRAM_CHAT_ID: diff --git a/subscribie/blueprints/admin/__init__.py b/subscribie/blueprints/admin/__init__.py index 96855bb5..3c398717 100644 --- a/subscribie/blueprints/admin/__init__.py +++ b/subscribie/blueprints/admin/__init__.py @@ -83,6 +83,7 @@ UpcomingInvoice, Document, PlanQuestionAssociation, + SpamEmailDomain, ) from .subscription import ( update_stripe_subscription_statuses, @@ -992,6 +993,17 @@ def set_stripe_livemode(): @admin.route("/connect/stripe-connect", methods=["GET"]) @login_required def stripe_connect(): + # 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_domain} " + "attempted to connect stripe" + ) + return "