diff --git a/.env-dist b/.env-dist index a7fc96c..fc82b83 100644 --- a/.env-dist +++ b/.env-dist @@ -9,10 +9,10 @@ ENVIRONMENT=local # EMAIL FROM_EMAIL=noreply@notifications.ideologicalatlas.com FROM_EMAIL_NAME=Ideological Atlas -BASE_SITE_URL=localhost:4045 +BASE_SITE_URL=http://localhost:3000 # TESTING TEST_EMAIL=CHANGE-ME TEST_LANGUAGE=es TEST_TEMPLATE=register -TEST_CONTEXT={"user_uuid": "test-uuid-123", "name": "Test User"} +TEST_CONTEXT={"verification_token": "test-uuid-123", "name": "Test User"} diff --git a/README.md b/README.md index 2d75e8c..e1af92b 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ uv run uvicorn main:app --host 0.0.0.0 --port 5051 --reload "template_name": "register", "language": "es", "context": { - "user_uuid": "123e4567-e89b-12d3-a456-426614174000", + "verification_token": "EXAMPLE-TOKEN", "name": "Jane Doe" } } @@ -189,7 +189,7 @@ Or manually: curl -X POST http://localhost:5051/notifications/send \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_SECRET_KEY" \ - -d '{"to_email": "test@test.com", "template_name": "register", "language": "en", "context": {"user_uuid": "123"}}' + -d '{"to_email": "test@test.com", "template_name": "register", "language": "en", "context": {"verification_token": "EXAMPLE-TOKEN"}}' ``` diff --git a/src/app/core/theme.py b/src/app/core/theme.py new file mode 100644 index 0000000..8ca1e3d --- /dev/null +++ b/src/app/core/theme.py @@ -0,0 +1,25 @@ +from dataclasses import dataclass + + +@dataclass +class Theme: + background: str = "#020617" + foreground: str = "#f8fafc" + + card: str = "#0f172a" + card_foreground: str = "#f8fafc" + border: str = "#1e293b" + + primary: str = "#338f39" + primary_foreground: str = "#ffffff" + + secondary: str = "#1e293b" + secondary_foreground: str = "#f8fafc" + + muted_foreground: str = "#94a3b8" + + destructive: str = "#ef4444" + destructive_foreground: str = "#ffffff" + + +theme = Theme() diff --git a/src/app/services/email_engine.py b/src/app/services/email_engine.py index 0019967..b131d78 100644 --- a/src/app/services/email_engine.py +++ b/src/app/services/email_engine.py @@ -8,6 +8,7 @@ from jinja2 import Environment, FileSystemLoader, TemplateNotFound from app.core.config import settings +from app.core.theme import theme logger = logging.getLogger(__name__) @@ -58,6 +59,7 @@ def _render_template( "project_name": settings.PROJECT_NAME, "t": translations, "year": datetime.now().year, + "theme": theme, } final_context = {**global_context, **specific_context} diff --git a/src/templates/base.html b/src/templates/base.html index 2cac7fd..a937cac 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -5,46 +5,71 @@ {% block subject %}{{ t.base.subject_prefix }}{% endblock %} - - - - + +
- - - - - - - - + + +
+
+ + - -
+ + + + + +
+ {{ project_name }} +
+ + + + + + + + +
+ {% block content %}{% endblock %} +
+

+ {{ t.base.doubts }}
+ {{ t.base.contact_text }} {{ t.base.contact_email }} {{ t.base.help_text }} +

+

+ {{ t.base.thanks }} +

+

+ {{ t.base.footer_reason }} {{ t.base.contact_email }}. +

+

+ © {{ year | default('2026') }} {{ t.base.rights }} +

+
-
+ + + + + +
+ +
+ diff --git a/src/templates/register/content.html b/src/templates/register/content.html index 228c5a9..9c71eb2 100644 --- a/src/templates/register/content.html +++ b/src/templates/register/content.html @@ -3,24 +3,28 @@ {% block subject %}{{ t.register.subject }}{% endblock %} {% block content %} -

{{ t.register.title }}

-

+

{{ t.register.title }}

+

{{ t.register.intro|safe }}

-

- {{ t.register.verify_text }} -

-

- + +

+ {{ t.register.button }}

-

+ +

+ {{ t.register.verify_text }} +

+ +

{{ t.register.fallback_text }}
- {{site_url}}/api/users/verify/{{user_uuid}} + {{site_url}}/verify/{{verification_token}}

-

+ +

{{ t.register.salutation }}
- {{ t.register.team }} + {{ t.register.team }}

{% endblock %} diff --git a/src/templates/register_google/content.html b/src/templates/register_google/content.html index cc3dac4..9e4187c 100644 --- a/src/templates/register_google/content.html +++ b/src/templates/register_google/content.html @@ -3,17 +3,19 @@ {% block subject %}{{ t.register_google.subject }}{% endblock %} {% block content %} -

{{ t.register_google.title }}

-

+

{{ t.register_google.title }}

+

{{ t.register_google.intro|safe }}

-

- + +

+ {{ t.register_google.button }}

-

+ +

{{ t.register_google.salutation }}
- {{ t.register_google.team }} + {{ t.register_google.team }}

{% endblock %} diff --git a/src/templates/registration_reminder_30_days/content.html b/src/templates/registration_reminder_30_days/content.html index 3c590f8..3b6feb8 100644 --- a/src/templates/registration_reminder_30_days/content.html +++ b/src/templates/registration_reminder_30_days/content.html @@ -3,24 +3,24 @@ {% block subject %}{{ t.registration_reminder_30_days.subject }}{% endblock %} {% block content %} -

{{ t.registration_reminder_30_days.title }}

-

+

{{ t.registration_reminder_30_days.title }}

+

{{ t.registration_reminder_30_days.intro|safe }}

-

+

{{ t.registration_reminder_30_days.verify_text }} -

-

- +

+

+ {{ t.registration_reminder_30_days.button }}

-

+

{{ t.registration_reminder_30_days.fallback_text }}
- {{site_url}}/api/users/verify/{{user_uuid}} + {{site_url}}/verify/{{verification_token}}

-

+

{{ t.registration_reminder_30_days.salutation }}
- {{ t.registration_reminder_30_days.team }} + {{ t.registration_reminder_30_days.team }}

{% endblock %} diff --git a/src/templates/registration_reminder_3_days/content.html b/src/templates/registration_reminder_3_days/content.html index 45a4525..b6204ba 100644 --- a/src/templates/registration_reminder_3_days/content.html +++ b/src/templates/registration_reminder_3_days/content.html @@ -3,24 +3,24 @@ {% block subject %}{{ t.registration_reminder_3_days.subject }}{% endblock %} {% block content %} -

{{ t.registration_reminder_3_days.title }}

-

+

{{ t.registration_reminder_3_days.title }}

+

{{ t.registration_reminder_3_days.intro|safe }}

-

+

{{ t.registration_reminder_3_days.verify_text }} -

-

- +

+

+ {{ t.registration_reminder_3_days.button }}

-

+

{{ t.registration_reminder_3_days.fallback_text }}
- {{site_url}}/api/users/verify/{{user_uuid}} + {{site_url}}/verify/{{verification_token}}

-

+

{{ t.registration_reminder_3_days.salutation }}
- {{ t.registration_reminder_3_days.team }} + {{ t.registration_reminder_3_days.team }}

{% endblock %} diff --git a/src/templates/registration_reminder_7_days/content.html b/src/templates/registration_reminder_7_days/content.html index c12bd9f..7965d04 100644 --- a/src/templates/registration_reminder_7_days/content.html +++ b/src/templates/registration_reminder_7_days/content.html @@ -3,24 +3,24 @@ {% block subject %}{{ t.registration_reminder_7_days.subject }}{% endblock %} {% block content %} -

{{ t.registration_reminder_7_days.title }}

-

+

{{ t.registration_reminder_7_days.title }}

+

{{ t.registration_reminder_7_days.intro|safe }}

-

+

{{ t.registration_reminder_7_days.verify_text }} -

-

- +

+

+ {{ t.registration_reminder_7_days.button }}

-

+

{{ t.registration_reminder_7_days.fallback_text }}
- {{site_url}}/api/users/verify/{{user_uuid}} + {{site_url}}/verify/{{verification_token}}

-

+

{{ t.registration_reminder_7_days.salutation }}
- {{ t.registration_reminder_7_days.team }} + {{ t.registration_reminder_7_days.team }}

{% endblock %} diff --git a/src/templates/user_deleted_due_no_verification/content.html b/src/templates/user_deleted_due_no_verification/content.html index 6cff807..3be8f07 100644 --- a/src/templates/user_deleted_due_no_verification/content.html +++ b/src/templates/user_deleted_due_no_verification/content.html @@ -3,20 +3,20 @@ {% block subject %}{{ t.user_deleted_due_no_verification.subject }}{% endblock %} {% block content %} -

{{ t.user_deleted_due_no_verification.title }}

-

+

{{ t.user_deleted_due_no_verification.title }}

+

{{ t.user_deleted_due_no_verification.intro|safe }}

-

+

{{ t.user_deleted_due_no_verification.re_register_text }} -

-

- +

+

+ {{ t.user_deleted_due_no_verification.button }}

-

+

{{ t.user_deleted_due_no_verification.salutation }}
- {{ t.user_deleted_due_no_verification.team }} + {{ t.user_deleted_due_no_verification.team }}

{% endblock %}