-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add a preferred email option in account settings (Fixes #408) * Automatically handle column filtering * 🌐 Update German lang strings --------- Co-authored-by: Andreas Müller <[email protected]>
- Loading branch information
1 parent
41ca26a
commit 5991e5b
Showing
18 changed files
with
227 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...c/appointment/migrations/versions/2024_05_28_1745-9fe08ba6f2ed_update_subscribers_add_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""update subscribers add preferred_email | ||
Revision ID: 9fe08ba6f2ed | ||
Revises: 89e1197d980d | ||
Create Date: 2024-05-28 17:45:48.192560 | ||
""" | ||
import os | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy_utils import StringEncryptedType | ||
from sqlalchemy_utils.types.encrypted.encrypted_type import AesEngine | ||
|
||
|
||
def secret(): | ||
return os.getenv("DB_SECRET") | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '9fe08ba6f2ed' | ||
down_revision = '89e1197d980d' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column('subscribers', sa.Column('secondary_email', StringEncryptedType(sa.String, secret, AesEngine, "pkcs5", length=255), nullable=True, index=True)) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column('subscribers', 'secondary_email') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ def test_update_me(self, with_db, with_client): | |
"username": "test", | ||
"name": "Test Account", | ||
"timezone": "Europe/Berlin", | ||
"secondary_email": "[email protected]" | ||
}, | ||
headers=auth_headers, | ||
) | ||
|
@@ -20,21 +21,17 @@ def test_update_me(self, with_db, with_client): | |
assert data["username"] == "test" | ||
assert data["name"] == "Test Account" | ||
assert data["timezone"] == "Europe/Berlin" | ||
|
||
# Can't test login right now | ||
|
||
# response = client.get("/login", headers=headers) | ||
# data = response.json() | ||
# assert data["username"] == "test" | ||
# assert data["name"] == "Test Account" | ||
# assert data["timezone"] == "Europe/Berlin" | ||
# Response returns preferred_email | ||
assert data["preferred_email"] == "[email protected]" | ||
|
||
# Confirm the data was saved | ||
with with_db() as db: | ||
subscriber = repo.subscriber.get_by_email(db, os.getenv('TEST_USER_EMAIL')) | ||
assert subscriber.username == "test" | ||
assert subscriber.name == "Test Account" | ||
assert subscriber.timezone == "Europe/Berlin" | ||
assert subscriber.secondary_email == "[email protected]" | ||
assert subscriber.preferred_email == "[email protected]" | ||
|
||
def test_signed_short_link(self, with_client): | ||
"""Retrieves our unique short link, and ensures it exists""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.