diff --git a/packages/notifications-library/src/notifications_library/_models.py b/packages/notifications-library/src/notifications_library/_models.py index 6b52d8d40075..c7087cf7f7eb 100644 --- a/packages/notifications-library/src/notifications_library/_models.py +++ b/packages/notifications-library/src/notifications_library/_models.py @@ -30,9 +30,13 @@ class SharerData: @dataclass(frozen=True) class ProductUIData: - logo_url: str - strong_color: str project_alias: str + logo_url: str | None = ( + None # default_logo = "https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-white.svg" in base.html + ) + strong_color: str | None = ( + None # default_strong_color = "rgb(131, 0, 191)" in base.html + ) @dataclass(frozen=True) @@ -41,5 +45,5 @@ class ProductData: display_name: str vendor_display_inline: str support_email: str - homepage_url: str + homepage_url: str | None # default_homepage = "https://osparc.io/" in base.html ui: ProductUIData diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.content.html b/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.content.html new file mode 100644 index 000000000000..3a7c0f8a48cc --- /dev/null +++ b/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.content.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} +{% block title %} {% include 'on_account_approved.email.subject.txt' %} {% endblock %} +{% block content %} +
Dear {{ user.first_name or user.user_name }},
+ ++ Thank you for your interest in {{ product.display_name }}. We are pleased to provide you with a one-time invitation link to register on the platform. +
+ ++ Click here to access the registration page. +
+ ++ Please follow the on-screen information and proceed with your registration. If any problem should occur, please feel free to contact us at {{ product.support_email }}. +
+ +Enjoy {{ product.display_name }}!
+ +Best regards,
+ +The {{ product.display_name }} Team
+{% endblock %} diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.content.txt b/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.content.txt new file mode 100644 index 000000000000..13fa87c59150 --- /dev/null +++ b/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.content.txt @@ -0,0 +1,13 @@ +Dear {{ user.first_name or user.user_name }}, + +Thank you for your interest in {{ product.display_name }} . We are pleased to provide you with a one-time invitation link to register on the platform. + +Click {{ link }} to access the registration page. + +Please follow the on-screen information and proceed with your registration. If any problem should occur, please feel free to contact us at {{ product.support_email }}. + +Enjoy {{ product.display_name }} ! + +Best regards, + +The {{ product.display_name }} Team diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.subject.txt b/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.subject.txt new file mode 100644 index 000000000000..2e1c9474f9ba --- /dev/null +++ b/packages/notifications-library/src/notifications_library/templates/on_account_approved.email.subject.txt @@ -0,0 +1 @@ +Your Registration Request for {{ product.display_name }} Has Been Accepted diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_form.email.subject.txt b/packages/notifications-library/src/notifications_library/templates/on_account_form.email.subject.txt deleted file mode 100644 index 73cc8bff1a85..000000000000 --- a/packages/notifications-library/src/notifications_library/templates/on_account_form.email.subject.txt +++ /dev/null @@ -1 +0,0 @@ -Request for an Account in {{ host }} diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.content.html b/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.content.html new file mode 100644 index 000000000000..abe3482435d9 --- /dev/null +++ b/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.content.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} +{% block title %} {% include 'on_account_rejected.email.subject.txt' %} {% endblock %} +{% block content %} +Dear {{ user.first_name or user.user_name }},
+ ++ Thank you for your interest in {{ product.display_name }}. Unfortunately, your registration is not eligible for participation in this program. +
+ ++ In case of further interest in this or other solutions we might offer, please contact us at {{ product.support_email }}. +
+ +Best regards,
+ +The {{ product.display_name }} Team
+{% endblock %} diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.content.txt b/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.content.txt new file mode 100644 index 000000000000..740943861141 --- /dev/null +++ b/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.content.txt @@ -0,0 +1,8 @@ +Dear {{ user.first_name or user.user_name }}, + +Thank you for your interest in {{ product.display_name }}. Unfortunately, your registration is not eligible for participation in this program. + +In case of further interest in this or other solutions we might offer, please check contact us at {{ product.support_email }}. + +Best regards, +The {{ product.display_name }} Team diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.subject.txt b/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.subject.txt new file mode 100644 index 000000000000..6ff381db88fd --- /dev/null +++ b/packages/notifications-library/src/notifications_library/templates/on_account_rejected.email.subject.txt @@ -0,0 +1 @@ +Your Registration Request for {{ product.display_name }} Has Been Denied diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_form.email.content.html b/packages/notifications-library/src/notifications_library/templates/on_account_requested.email.content.html similarity index 86% rename from packages/notifications-library/src/notifications_library/templates/on_account_form.email.content.html rename to packages/notifications-library/src/notifications_library/templates/on_account_requested.email.content.html index edf5f1a640cc..ae26bed2bf47 100644 --- a/packages/notifications-library/src/notifications_library/templates/on_account_form.email.content.html +++ b/packages/notifications-library/src/notifications_library/templates/on_account_requested.email.content.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% block title %} {% include 'on_account_form.email.subject.txt' %} {% endblock %} +{% block title %} {% include 'on_account_requested.email.subject.txt' %} {% endblock %} {% block content %}Dear Support team diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_form.email.content.txt b/packages/notifications-library/src/notifications_library/templates/on_account_requested.email.content.txt similarity index 100% rename from packages/notifications-library/src/notifications_library/templates/on_account_form.email.content.txt rename to packages/notifications-library/src/notifications_library/templates/on_account_requested.email.content.txt diff --git a/packages/notifications-library/src/notifications_library/templates/on_account_requested.email.subject.txt b/packages/notifications-library/src/notifications_library/templates/on_account_requested.email.subject.txt new file mode 100644 index 000000000000..8691a1732914 --- /dev/null +++ b/packages/notifications-library/src/notifications_library/templates/on_account_requested.email.subject.txt @@ -0,0 +1 @@ +Request for an Account in {{ product.display_name }}. diff --git a/packages/notifications-library/tests/conftest.py b/packages/notifications-library/tests/conftest.py index 7969423c7388..006b7ed1a7b3 100644 --- a/packages/notifications-library/tests/conftest.py +++ b/packages/notifications-library/tests/conftest.py @@ -61,13 +61,12 @@ def product_data( ) -> ProductData: vendor: Vendor = product["vendor"] + vendor_ui = vendor.get("ui", {}) + product_ui = ProductUIData( - logo_url=vendor.get("ui", {}).get( - "logo_url", - "https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-white.svg", - ), - strong_color=vendor.get("ui", {}).get("strong_color", "rgb(131, 0, 191)"), - project_alias=vendor.get("ui", {}).get("project_alias", "project"), + logo_url=vendor_ui.get("logo_url"), + strong_color=vendor_ui.get("strong_color"), + project_alias=vendor_ui["project_alias"], ) return ProductData( # type: ignore @@ -75,7 +74,7 @@ def product_data( display_name=product["display_name"], vendor_display_inline=f"{vendor.get('name','')}, {vendor.get('address','')}", support_email=product["support_email"], - homepage_url=vendor.get("url", "https://osparc.io/"), + homepage_url=vendor.get("url"), ui=product_ui, ) diff --git a/packages/notifications-library/tests/email/test_email_events.py b/packages/notifications-library/tests/email/test_email_events.py index cacbfc6578aa..52cc84eeedd7 100644 --- a/packages/notifications-library/tests/email/test_email_events.py +++ b/packages/notifications-library/tests/email/test_email_events.py @@ -88,7 +88,7 @@ def event_extra_data( # noqa: PLR0911 host_url = f"https://{product_name}.io" match event_name: - case "on_account_form": + case "on_account_requested": return { "host": host_url, "name": "support-team", @@ -106,6 +106,15 @@ def event_extra_data( # noqa: PLR0911 "ipinfo": ipinfo, "dumps": functools.partial(_safe_json_dumps, indent=1), } + case "on_account_rejected": + return { + "host": host_url, + } + case "on_account_approved": + return { + "host": host_url, + "link": f"{host_url}?invitation={code}", + } case "on_change_email": return { "host": host_url, @@ -173,7 +182,9 @@ def event_attachments(event_name: str, faker: Faker) -> list[tuple[bytes, str]]: @pytest.mark.parametrize( "event_name", [ - "on_account_form", + "on_account_approved", + "on_account_requested", + "on_account_rejected", "on_change_email", "on_new_code", "on_new_invitation", @@ -252,7 +263,7 @@ async def test_email_event( @pytest.mark.parametrize( "event_name", [ - "on_account_form", + "on_account_requested", ], ) async def test_email_with_reply_to( diff --git a/packages/notifications-library/tests/test__templates.py b/packages/notifications-library/tests/test__templates.py index b4e746b54ff5..58bce016289f 100644 --- a/packages/notifications-library/tests/test__templates.py +++ b/packages/notifications-library/tests/test__templates.py @@ -11,7 +11,7 @@ @pytest.mark.parametrize( "event_name", [ - "on_account_form", + "on_account_requested", "on_change_email", "on_new_code", "on_new_invitation", diff --git a/packages/pytest-simcore/src/pytest_simcore/helpers/faker_factories.py b/packages/pytest-simcore/src/pytest_simcore/helpers/faker_factories.py index faa36f5d61eb..5aeb6c3be667 100644 --- a/packages/pytest-simcore/src/pytest_simcore/helpers/faker_factories.py +++ b/packages/pytest-simcore/src/pytest_simcore/helpers/faker_factories.py @@ -263,7 +263,7 @@ def random_product( invitation_form=fake.boolean(), address=fake.address().replace("\n", ". "), ui=VendorUI( - logo_url=fake.url(), + logo_url="https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/static-webserver/client/source/resource/osparc/osparc-black.svg", strong_color=fake.color(), project_alias=fake.random_element(elements=["project", "study"]), ),