Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
5776128905 | |||
d661860f4c | |||
0a52e32972 |
@ -23,7 +23,7 @@ COPY poetry.lock pyproject.toml ./
|
|||||||
# Install and setup poetry
|
# Install and setup poetry
|
||||||
RUN pip install -U pip \
|
RUN pip install -U pip \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt install -y curl netcat-traditional gcc python3-dev gnupg git libre2-dev \
|
&& apt install -y curl netcat-traditional gcc python3-dev gnupg git libre2-dev cmake ninja-build\
|
||||||
&& curl -sSL https://install.python-poetry.org | python3 - \
|
&& curl -sSL https://install.python-poetry.org | python3 - \
|
||||||
# Remove curl and netcat from the image
|
# Remove curl and netcat from the image
|
||||||
&& apt-get purge -y curl netcat-traditional \
|
&& apt-get purge -y curl netcat-traditional \
|
||||||
@ -31,7 +31,7 @@ RUN pip install -U pip \
|
|||||||
&& poetry config virtualenvs.create false \
|
&& poetry config virtualenvs.create false \
|
||||||
&& poetry install --no-interaction --no-ansi --no-root \
|
&& poetry install --no-interaction --no-ansi --no-root \
|
||||||
# Clear apt cache \
|
# Clear apt cache \
|
||||||
&& apt-get purge -y libre2-dev \
|
&& apt-get purge -y libre2-dev cmake ninja-build\
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
@ -5,10 +5,11 @@ from typing import Optional
|
|||||||
|
|
||||||
from arrow import Arrow
|
from arrow import Arrow
|
||||||
from newrelic import agent
|
from newrelic import agent
|
||||||
|
from sqlalchemy import or_
|
||||||
|
|
||||||
from app.db import Session
|
from app.db import Session
|
||||||
from app.email_utils import send_welcome_email
|
from app.email_utils import send_welcome_email
|
||||||
from app.utils import sanitize_email
|
from app.utils import sanitize_email, canonicalize_email
|
||||||
from app.errors import (
|
from app.errors import (
|
||||||
AccountAlreadyLinkedToAnotherPartnerException,
|
AccountAlreadyLinkedToAnotherPartnerException,
|
||||||
AccountIsUsingAliasAsEmail,
|
AccountIsUsingAliasAsEmail,
|
||||||
@ -131,8 +132,9 @@ class ClientMergeStrategy(ABC):
|
|||||||
class NewUserStrategy(ClientMergeStrategy):
|
class NewUserStrategy(ClientMergeStrategy):
|
||||||
def process(self) -> LinkResult:
|
def process(self) -> LinkResult:
|
||||||
# Will create a new SL User with a random password
|
# Will create a new SL User with a random password
|
||||||
|
canonical_email = canonicalize_email(self.link_request.email)
|
||||||
new_user = User.create(
|
new_user = User.create(
|
||||||
email=self.link_request.email,
|
email=canonical_email,
|
||||||
name=self.link_request.name,
|
name=self.link_request.name,
|
||||||
password=random_string(20),
|
password=random_string(20),
|
||||||
activated=True,
|
activated=True,
|
||||||
@ -213,11 +215,21 @@ def process_login_case(
|
|||||||
partner_id=partner.id, external_user_id=link_request.external_user_id
|
partner_id=partner.id, external_user_id=link_request.external_user_id
|
||||||
)
|
)
|
||||||
if partner_user is None:
|
if partner_user is None:
|
||||||
|
canonical_email = canonicalize_email(link_request.email)
|
||||||
# We didn't find any SimpleLogin user registered with that partner user id
|
# We didn't find any SimpleLogin user registered with that partner user id
|
||||||
# Make sure they aren't using an alias as their link email
|
# Make sure they aren't using an alias as their link email
|
||||||
check_alias(link_request.email)
|
check_alias(link_request.email)
|
||||||
|
check_alias(canonical_email)
|
||||||
# Try to find it using the partner's e-mail address
|
# Try to find it using the partner's e-mail address
|
||||||
user = User.get_by(email=link_request.email)
|
users = User.filter(
|
||||||
|
or_(User.email == link_request.email, User.email == canonical_email)
|
||||||
|
).all()
|
||||||
|
if len(users) > 1:
|
||||||
|
user = [user for user in users if user.email == canonical_email][0]
|
||||||
|
elif len(users) == 1:
|
||||||
|
user = users[0]
|
||||||
|
else:
|
||||||
|
user = None
|
||||||
return get_login_strategy(link_request, user, partner).process()
|
return get_login_strategy(link_request, user, partner).process()
|
||||||
else:
|
else:
|
||||||
# We found the SL user registered with that partner user id
|
# We found the SL user registered with that partner user id
|
||||||
|
@ -611,6 +611,26 @@ class NewsletterAdmin(SLModelView):
|
|||||||
else:
|
else:
|
||||||
flash(error_msg, "error")
|
flash(error_msg, "error")
|
||||||
|
|
||||||
|
@action(
|
||||||
|
"clone_newsletter",
|
||||||
|
"Clone this newsletter",
|
||||||
|
)
|
||||||
|
def clone_newsletter(self, newsletter_ids):
|
||||||
|
if len(newsletter_ids) != 1:
|
||||||
|
flash("you can only select 1 newsletter", "error")
|
||||||
|
return
|
||||||
|
|
||||||
|
newsletter_id = newsletter_ids[0]
|
||||||
|
newsletter: Newsletter = Newsletter.get(newsletter_id)
|
||||||
|
new_newsletter = Newsletter.create(
|
||||||
|
subject=newsletter.subject,
|
||||||
|
html=newsletter.html,
|
||||||
|
plain_text=newsletter.plain_text,
|
||||||
|
commit=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
flash(f"Newsletter {new_newsletter.subject} has been cloned", "success")
|
||||||
|
|
||||||
|
|
||||||
class NewsletterUserAdmin(SLModelView):
|
class NewsletterUserAdmin(SLModelView):
|
||||||
column_searchable_list = ["id"]
|
column_searchable_list = ["id"]
|
||||||
|
@ -3184,7 +3184,7 @@ class MessageIDMatching(Base, ModelMixin):
|
|||||||
|
|
||||||
# to track what email_log that has created this matching
|
# to track what email_log that has created this matching
|
||||||
email_log_id = sa.Column(
|
email_log_id = sa.Column(
|
||||||
sa.ForeignKey("email_log.id", ondelete="cascade"), nullable=True
|
sa.ForeignKey("email_log.id", ondelete="cascade"), nullable=True, index=True
|
||||||
)
|
)
|
||||||
|
|
||||||
email_log = orm.relationship("EmailLog")
|
email_log = orm.relationship("EmailLog")
|
||||||
@ -3517,7 +3517,7 @@ class PartnerSubscription(Base, ModelMixin):
|
|||||||
|
|
||||||
class Newsletter(Base, ModelMixin):
|
class Newsletter(Base, ModelMixin):
|
||||||
__tablename__ = "newsletter"
|
__tablename__ = "newsletter"
|
||||||
subject = sa.Column(sa.String(), nullable=False, unique=True, index=True)
|
subject = sa.Column(sa.String(), nullable=False, index=True)
|
||||||
|
|
||||||
html = sa.Column(sa.Text)
|
html = sa.Column(sa.Text)
|
||||||
plain_text = sa.Column(sa.Text)
|
plain_text = sa.Column(sa.Text)
|
||||||
|
@ -89,7 +89,6 @@ aghast
|
|||||||
agile
|
agile
|
||||||
agility
|
agility
|
||||||
aging
|
aging
|
||||||
agnostic
|
|
||||||
agonize
|
agonize
|
||||||
agonizing
|
agonizing
|
||||||
agony
|
agony
|
||||||
@ -375,8 +374,6 @@ augmented
|
|||||||
august
|
august
|
||||||
authentic
|
authentic
|
||||||
author
|
author
|
||||||
autism
|
|
||||||
autistic
|
|
||||||
autograph
|
autograph
|
||||||
automaker
|
automaker
|
||||||
automated
|
automated
|
||||||
@ -446,7 +443,6 @@ backyard
|
|||||||
bacon
|
bacon
|
||||||
bacteria
|
bacteria
|
||||||
bacterium
|
bacterium
|
||||||
badass
|
|
||||||
badge
|
badge
|
||||||
badland
|
badland
|
||||||
badly
|
badly
|
||||||
@ -1106,7 +1102,6 @@ clinic
|
|||||||
clinking
|
clinking
|
||||||
clip
|
clip
|
||||||
clique
|
clique
|
||||||
cloak
|
|
||||||
clobber
|
clobber
|
||||||
clock
|
clock
|
||||||
clone
|
clone
|
||||||
@ -1776,7 +1771,6 @@ diagnosis
|
|||||||
diagram
|
diagram
|
||||||
dial
|
dial
|
||||||
diameter
|
diameter
|
||||||
diaper
|
|
||||||
diaphragm
|
diaphragm
|
||||||
diary
|
diary
|
||||||
dice
|
dice
|
||||||
@ -2032,9 +2026,6 @@ duffel
|
|||||||
dugout
|
dugout
|
||||||
duh
|
duh
|
||||||
duke
|
duke
|
||||||
duller
|
|
||||||
dullness
|
|
||||||
duly
|
|
||||||
dumping
|
dumping
|
||||||
dumpling
|
dumpling
|
||||||
dumpster
|
dumpster
|
||||||
@ -2527,8 +2518,6 @@ feisty
|
|||||||
feline
|
feline
|
||||||
felt-tip
|
felt-tip
|
||||||
feminine
|
feminine
|
||||||
feminism
|
|
||||||
feminist
|
|
||||||
feminize
|
feminize
|
||||||
femur
|
femur
|
||||||
fence
|
fence
|
||||||
@ -2667,7 +2656,6 @@ fondness
|
|||||||
fondue
|
fondue
|
||||||
font
|
font
|
||||||
food
|
food
|
||||||
fool
|
|
||||||
footage
|
footage
|
||||||
football
|
football
|
||||||
footbath
|
footbath
|
||||||
@ -2777,7 +2765,6 @@ gag
|
|||||||
gainfully
|
gainfully
|
||||||
gaining
|
gaining
|
||||||
gains
|
gains
|
||||||
gala
|
|
||||||
gallantly
|
gallantly
|
||||||
galleria
|
galleria
|
||||||
gallery
|
gallery
|
||||||
@ -3164,8 +3151,6 @@ hardware
|
|||||||
hardwired
|
hardwired
|
||||||
hardwood
|
hardwood
|
||||||
hardy
|
hardy
|
||||||
harmful
|
|
||||||
harmless
|
|
||||||
harmonica
|
harmonica
|
||||||
harmonics
|
harmonics
|
||||||
harmonize
|
harmonize
|
||||||
@ -3340,7 +3325,6 @@ identical
|
|||||||
identify
|
identify
|
||||||
identity
|
identity
|
||||||
ideology
|
ideology
|
||||||
idiocy
|
|
||||||
idiom
|
idiom
|
||||||
idly
|
idly
|
||||||
igloo
|
igloo
|
||||||
@ -3357,7 +3341,6 @@ imaging
|
|||||||
imbecile
|
imbecile
|
||||||
imitate
|
imitate
|
||||||
imitation
|
imitation
|
||||||
immature
|
|
||||||
immerse
|
immerse
|
||||||
immersion
|
immersion
|
||||||
imminent
|
imminent
|
||||||
@ -3387,14 +3370,10 @@ implode
|
|||||||
implosion
|
implosion
|
||||||
implosive
|
implosive
|
||||||
imply
|
imply
|
||||||
impolite
|
|
||||||
important
|
important
|
||||||
importer
|
importer
|
||||||
impose
|
impose
|
||||||
imposing
|
imposing
|
||||||
impotence
|
|
||||||
impotency
|
|
||||||
impotent
|
|
||||||
impound
|
impound
|
||||||
imprecise
|
imprecise
|
||||||
imprint
|
imprint
|
||||||
@ -3424,8 +3403,6 @@ irritable
|
|||||||
irritably
|
irritably
|
||||||
irritant
|
irritant
|
||||||
irritate
|
irritate
|
||||||
islamic
|
|
||||||
islamist
|
|
||||||
isolated
|
isolated
|
||||||
isolating
|
isolating
|
||||||
isolation
|
isolation
|
||||||
@ -3524,7 +3501,6 @@ june
|
|||||||
junior
|
junior
|
||||||
juniper
|
juniper
|
||||||
junkie
|
junkie
|
||||||
junkman
|
|
||||||
junkyard
|
junkyard
|
||||||
jurist
|
jurist
|
||||||
juror
|
juror
|
||||||
@ -3570,9 +3546,6 @@ king
|
|||||||
kinship
|
kinship
|
||||||
kinsman
|
kinsman
|
||||||
kinswoman
|
kinswoman
|
||||||
kissable
|
|
||||||
kisser
|
|
||||||
kissing
|
|
||||||
kitchen
|
kitchen
|
||||||
kite
|
kite
|
||||||
kitten
|
kitten
|
||||||
@ -3649,7 +3622,6 @@ laundry
|
|||||||
laurel
|
laurel
|
||||||
lavender
|
lavender
|
||||||
lavish
|
lavish
|
||||||
laxative
|
|
||||||
lazily
|
lazily
|
||||||
laziness
|
laziness
|
||||||
lazy
|
lazy
|
||||||
@ -3690,7 +3662,6 @@ liable
|
|||||||
liberty
|
liberty
|
||||||
librarian
|
librarian
|
||||||
library
|
library
|
||||||
licking
|
|
||||||
licorice
|
licorice
|
||||||
lid
|
lid
|
||||||
life
|
life
|
||||||
@ -3741,8 +3712,6 @@ livestock
|
|||||||
lividly
|
lividly
|
||||||
living
|
living
|
||||||
lizard
|
lizard
|
||||||
lubricant
|
|
||||||
lubricate
|
|
||||||
lucid
|
lucid
|
||||||
luckily
|
luckily
|
||||||
luckiness
|
luckiness
|
||||||
@ -3878,7 +3847,6 @@ marshland
|
|||||||
marshy
|
marshy
|
||||||
marsupial
|
marsupial
|
||||||
marvelous
|
marvelous
|
||||||
marxism
|
|
||||||
mascot
|
mascot
|
||||||
masculine
|
masculine
|
||||||
mashed
|
mashed
|
||||||
@ -3914,8 +3882,6 @@ maximum
|
|||||||
maybe
|
maybe
|
||||||
mayday
|
mayday
|
||||||
mayflower
|
mayflower
|
||||||
moaner
|
|
||||||
moaning
|
|
||||||
mobile
|
mobile
|
||||||
mobility
|
mobility
|
||||||
mobilize
|
mobilize
|
||||||
@ -4124,7 +4090,6 @@ nemeses
|
|||||||
nemesis
|
nemesis
|
||||||
neon
|
neon
|
||||||
nephew
|
nephew
|
||||||
nerd
|
|
||||||
nervous
|
nervous
|
||||||
nervy
|
nervy
|
||||||
nest
|
nest
|
||||||
@ -4139,7 +4104,6 @@ never
|
|||||||
next
|
next
|
||||||
nibble
|
nibble
|
||||||
nickname
|
nickname
|
||||||
nicotine
|
|
||||||
niece
|
niece
|
||||||
nifty
|
nifty
|
||||||
nimble
|
nimble
|
||||||
@ -4167,14 +4131,10 @@ nuptials
|
|||||||
nursery
|
nursery
|
||||||
nursing
|
nursing
|
||||||
nurture
|
nurture
|
||||||
nutcase
|
|
||||||
nutlike
|
nutlike
|
||||||
nutmeg
|
nutmeg
|
||||||
nutrient
|
nutrient
|
||||||
nutshell
|
nutshell
|
||||||
nuttiness
|
|
||||||
nutty
|
|
||||||
nuzzle
|
|
||||||
nylon
|
nylon
|
||||||
oaf
|
oaf
|
||||||
oak
|
oak
|
||||||
@ -4205,7 +4165,6 @@ obstinate
|
|||||||
obstruct
|
obstruct
|
||||||
obtain
|
obtain
|
||||||
obtrusive
|
obtrusive
|
||||||
obtuse
|
|
||||||
obvious
|
obvious
|
||||||
occultist
|
occultist
|
||||||
occupancy
|
occupancy
|
||||||
@ -4446,7 +4405,6 @@ palpitate
|
|||||||
paltry
|
paltry
|
||||||
pampered
|
pampered
|
||||||
pamperer
|
pamperer
|
||||||
pampers
|
|
||||||
pamphlet
|
pamphlet
|
||||||
panama
|
panama
|
||||||
pancake
|
pancake
|
||||||
@ -4651,7 +4609,6 @@ plated
|
|||||||
platform
|
platform
|
||||||
plating
|
plating
|
||||||
platinum
|
platinum
|
||||||
platonic
|
|
||||||
platter
|
platter
|
||||||
platypus
|
platypus
|
||||||
plausible
|
plausible
|
||||||
@ -4777,8 +4734,6 @@ prancing
|
|||||||
pranker
|
pranker
|
||||||
prankish
|
prankish
|
||||||
prankster
|
prankster
|
||||||
prayer
|
|
||||||
praying
|
|
||||||
preacher
|
preacher
|
||||||
preaching
|
preaching
|
||||||
preachy
|
preachy
|
||||||
@ -4796,8 +4751,6 @@ prefix
|
|||||||
preflight
|
preflight
|
||||||
preformed
|
preformed
|
||||||
pregame
|
pregame
|
||||||
pregnancy
|
|
||||||
pregnant
|
|
||||||
preheated
|
preheated
|
||||||
prelaunch
|
prelaunch
|
||||||
prelaw
|
prelaw
|
||||||
@ -4937,7 +4890,6 @@ prudishly
|
|||||||
prune
|
prune
|
||||||
pruning
|
pruning
|
||||||
pry
|
pry
|
||||||
psychic
|
|
||||||
public
|
public
|
||||||
publisher
|
publisher
|
||||||
pucker
|
pucker
|
||||||
@ -4957,8 +4909,7 @@ punctual
|
|||||||
punctuate
|
punctuate
|
||||||
punctured
|
punctured
|
||||||
pungent
|
pungent
|
||||||
punisher
|
punishe
|
||||||
punk
|
|
||||||
pupil
|
pupil
|
||||||
puppet
|
puppet
|
||||||
puppy
|
puppy
|
||||||
@ -5040,7 +4991,6 @@ quote
|
|||||||
rabid
|
rabid
|
||||||
race
|
race
|
||||||
racing
|
racing
|
||||||
racism
|
|
||||||
rack
|
rack
|
||||||
racoon
|
racoon
|
||||||
radar
|
radar
|
||||||
@ -5155,7 +5105,6 @@ recount
|
|||||||
recoup
|
recoup
|
||||||
recovery
|
recovery
|
||||||
recreate
|
recreate
|
||||||
rectal
|
|
||||||
rectangle
|
rectangle
|
||||||
rectified
|
rectified
|
||||||
rectify
|
rectify
|
||||||
@ -5622,7 +5571,6 @@ sarcastic
|
|||||||
sardine
|
sardine
|
||||||
sash
|
sash
|
||||||
sasquatch
|
sasquatch
|
||||||
sassy
|
|
||||||
satchel
|
satchel
|
||||||
satiable
|
satiable
|
||||||
satin
|
satin
|
||||||
@ -5651,7 +5599,6 @@ scaling
|
|||||||
scallion
|
scallion
|
||||||
scallop
|
scallop
|
||||||
scalping
|
scalping
|
||||||
scam
|
|
||||||
scandal
|
scandal
|
||||||
scanner
|
scanner
|
||||||
scanning
|
scanning
|
||||||
@ -5928,8 +5875,6 @@ silent
|
|||||||
silica
|
silica
|
||||||
silicon
|
silicon
|
||||||
silk
|
silk
|
||||||
silliness
|
|
||||||
silly
|
|
||||||
silo
|
silo
|
||||||
silt
|
silt
|
||||||
silver
|
silver
|
||||||
@ -6196,7 +6141,6 @@ splinter
|
|||||||
splotchy
|
splotchy
|
||||||
splurge
|
splurge
|
||||||
spoilage
|
spoilage
|
||||||
spoiled
|
|
||||||
spoiler
|
spoiler
|
||||||
spoiling
|
spoiling
|
||||||
spoils
|
spoils
|
||||||
@ -7078,7 +7022,6 @@ undocked
|
|||||||
undoing
|
undoing
|
||||||
undone
|
undone
|
||||||
undrafted
|
undrafted
|
||||||
undress
|
|
||||||
undrilled
|
undrilled
|
||||||
undusted
|
undusted
|
||||||
undying
|
undying
|
||||||
|
@ -158677,16 +158677,6 @@ isis
|
|||||||
isize
|
isize
|
||||||
isl
|
isl
|
||||||
islay
|
islay
|
||||||
islam
|
|
||||||
islamic
|
|
||||||
islamism
|
|
||||||
islamist
|
|
||||||
islamistic
|
|
||||||
islamite
|
|
||||||
islamitic
|
|
||||||
islamitish
|
|
||||||
islamization
|
|
||||||
islamize
|
|
||||||
island
|
island
|
||||||
islanded
|
islanded
|
||||||
islander
|
islander
|
||||||
|
39
app/migrations/versions/2023_100510_46ecb648a47e_.py
Normal file
39
app/migrations/versions/2023_100510_46ecb648a47e_.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 46ecb648a47e
|
||||||
|
Revises: ec7fdde8da9f
|
||||||
|
Create Date: 2023-10-05 10:43:35.668902
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "46ecb648a47e"
|
||||||
|
down_revision = "ec7fdde8da9f"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.get_context().autocommit_block():
|
||||||
|
op.create_index(
|
||||||
|
op.f("ix_message_id_matching_email_log_id"),
|
||||||
|
"message_id_matching",
|
||||||
|
["email_log_id"],
|
||||||
|
unique=False,
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.get_context().autocommit_block():
|
||||||
|
op.drop_index(
|
||||||
|
op.f("ix_message_id_matching_email_log_id"),
|
||||||
|
table_name="message_id_matching",
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
31
app/migrations/versions/2023_110714_4bc54632d9aa_.py
Normal file
31
app/migrations/versions/2023_110714_4bc54632d9aa_.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 4bc54632d9aa
|
||||||
|
Revises: 46ecb648a47e
|
||||||
|
Create Date: 2023-11-07 14:02:17.610226
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '4bc54632d9aa'
|
||||||
|
down_revision = '46ecb648a47e'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_index('ix_newsletter_subject', table_name='newsletter')
|
||||||
|
op.create_index(op.f('ix_newsletter_subject'), 'newsletter', ['subject'], unique=False)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_index(op.f('ix_newsletter_subject'), table_name='newsletter')
|
||||||
|
op.create_index('ix_newsletter_subject', 'newsletter', ['subject'], unique=True)
|
||||||
|
# ### end Alembic commands ###
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 38 KiB |
@ -86,6 +86,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
|
{% if current_user.is_authenticated and current_user.should_show_upgrade_button() %}
|
||||||
|
|
||||||
|
<div class="alert alert-success text-center mb-0" role="alert">
|
||||||
|
Black Friday: $20 for the first year instead of $30. Available until December 1st.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% block announcement %}{% endblock %}
|
{% block announcement %}{% endblock %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- For flash messages -->
|
<!-- For flash messages -->
|
||||||
|
@ -57,6 +57,19 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block default_content %}
|
{% block default_content %}
|
||||||
|
|
||||||
|
<div class="alert alert-info">
|
||||||
|
Black Friday Deal: 33% off on the yearly plan for the <b>first</b> year ($20 instead of $30).
|
||||||
|
<br>
|
||||||
|
Please use this coupon code
|
||||||
|
<em data-toggle="tooltip"
|
||||||
|
title="Click to copy"
|
||||||
|
class="clipboard"
|
||||||
|
data-clipboard-text="BF2023">BF2023</em> during the checkout.
|
||||||
|
<br>
|
||||||
|
<img src="/static/images/coupon.png" class="m-2" style="max-width: 300px">
|
||||||
|
<br>
|
||||||
|
Available until December 1, 2023.
|
||||||
|
</div>
|
||||||
<div class="pb-8">
|
<div class="pb-8">
|
||||||
<div class="text-center mx-md-auto mb-8 mt-6">
|
<div class="text-center mx-md-auto mb-8 mt-6">
|
||||||
<h1>Upgrade to unlock premium features</h1>
|
<h1>Upgrade to unlock premium features</h1>
|
||||||
|
@ -18,7 +18,7 @@ from app.db import Session
|
|||||||
from app.errors import AccountAlreadyLinkedToAnotherPartnerException
|
from app.errors import AccountAlreadyLinkedToAnotherPartnerException
|
||||||
from app.models import Partner, PartnerUser, User
|
from app.models import Partner, PartnerUser, User
|
||||||
from app.proton.utils import get_proton_partner
|
from app.proton.utils import get_proton_partner
|
||||||
from app.utils import random_string
|
from app.utils import random_string, canonicalize_email
|
||||||
from tests.utils import random_email
|
from tests.utils import random_email
|
||||||
|
|
||||||
|
|
||||||
@ -377,3 +377,48 @@ def test_link_account_with_uppercase(flask_client):
|
|||||||
)
|
)
|
||||||
assert partner_user.partner_id == get_proton_partner().id
|
assert partner_user.partner_id == get_proton_partner().id
|
||||||
assert partner_user.external_user_id == partner_user_id
|
assert partner_user.external_user_id == partner_user_id
|
||||||
|
|
||||||
|
|
||||||
|
def test_login_to_account_with_canonical_email(flask_client):
|
||||||
|
email = "a.{rand}@gmail.com".format(rand=random_string(10))
|
||||||
|
canonical_email = canonicalize_email(email)
|
||||||
|
assert email != canonical_email
|
||||||
|
partner_user_id = random_string()
|
||||||
|
link_request = random_link_request(
|
||||||
|
external_user_id=partner_user_id, email=email.upper()
|
||||||
|
)
|
||||||
|
user = create_user(canonical_email)
|
||||||
|
assert user.email == canonical_email
|
||||||
|
res = process_login_case(link_request, get_proton_partner())
|
||||||
|
assert res.user.id == user.id
|
||||||
|
|
||||||
|
|
||||||
|
def test_login_to_account_with_canonical_email_if_there_is_also_non_canonical(
|
||||||
|
flask_client,
|
||||||
|
):
|
||||||
|
email = "a.{rand}@gmail.com".format(rand=random_string(10))
|
||||||
|
canonical_email = canonicalize_email(email)
|
||||||
|
assert email != canonical_email
|
||||||
|
partner_user_id = random_string()
|
||||||
|
link_request = random_link_request(
|
||||||
|
external_user_id=partner_user_id, email=email.upper()
|
||||||
|
)
|
||||||
|
user = create_user(canonical_email)
|
||||||
|
create_user(email)
|
||||||
|
assert user.email == canonical_email
|
||||||
|
res = process_login_case(link_request, get_proton_partner())
|
||||||
|
assert res.user.id == user.id
|
||||||
|
|
||||||
|
|
||||||
|
def test_login_creates_account_with_canonical_email(
|
||||||
|
flask_client,
|
||||||
|
):
|
||||||
|
email = "a.{rand}@gmail.com".format(rand=random_string(10))
|
||||||
|
canonical_email = canonicalize_email(email)
|
||||||
|
assert email != canonical_email
|
||||||
|
partner_user_id = random_string()
|
||||||
|
link_request = random_link_request(
|
||||||
|
external_user_id=partner_user_id, email=email.upper()
|
||||||
|
)
|
||||||
|
res = process_login_case(link_request, get_proton_partner())
|
||||||
|
assert res.user.email == canonical_email
|
||||||
|
Reference in New Issue
Block a user