From f34ac458f565da236fa8413df417e4039e6dd1d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vjeran=20Grozdani=C4=87?= Date: Wed, 5 Mar 2025 11:34:13 +0100 Subject: [PATCH] feat(partnership): set password email template (#86366) Currently for partnerships, when a new account was created we were sending recover account email asking users to set their password. Half of the logic needed to send another email was done, but it was never finished. Now we have a new email template where we ask user to set their password upon account creation --------- Co-authored-by: Fabian Schindler --- .../templates/sentry/emails/set_password.html | 20 +++++++++++++++++++ .../templates/sentry/emails/set_password.txt | 12 +++++++++++ src/sentry/users/models/lostpasswordhash.py | 5 +++++ 3 files changed, 37 insertions(+) create mode 100644 src/sentry/templates/sentry/emails/set_password.html create mode 100644 src/sentry/templates/sentry/emails/set_password.txt diff --git a/src/sentry/templates/sentry/emails/set_password.html b/src/sentry/templates/sentry/emails/set_password.html new file mode 100644 index 00000000000000..d5fa2e61ea121d --- /dev/null +++ b/src/sentry/templates/sentry/emails/set_password.html @@ -0,0 +1,20 @@ +{% extends "sentry/emails/base.html" %} + +{% load i18n %} + +{% block main %} +

Welcome to Sentry. We created your account, you just need to set a password and you'll be all set.

+ +

Set your Password

+ +

Once you are in, you can:

+ + +

If you weren't expecting this email, please ignore it.

+ +

The Sentry Team

+{% endblock %} diff --git a/src/sentry/templates/sentry/emails/set_password.txt b/src/sentry/templates/sentry/emails/set_password.txt new file mode 100644 index 00000000000000..23b94bc2c50c88 --- /dev/null +++ b/src/sentry/templates/sentry/emails/set_password.txt @@ -0,0 +1,12 @@ +Welcome to Sentry. We created your account, you just need to set a password and you'll be all set. + +{{ url|safe }} + +Once you are in, you can: +- Monitor your code in production +- Get realtime notifications for errors and latency problems +- Have all the context to debug critical issues + +If you weren't expecting this email, please ignore it. + +The Sentry Team diff --git a/src/sentry/users/models/lostpasswordhash.py b/src/sentry/users/models/lostpasswordhash.py index f6c98a98204e50..5d07da83c86f56 100644 --- a/src/sentry/users/models/lostpasswordhash.py +++ b/src/sentry/users/models/lostpasswordhash.py @@ -58,6 +58,10 @@ def send_relocate_account_email( ) -> None: cls._send_email("relocate_account", user, hash, {"orgs": orgs}) + @classmethod + def send_set_password_email(cls, user: User | RpcUser, hash: str, **kwargs: Any) -> None: + cls._send_email("set_password", user, hash, extra=kwargs) + @classmethod def _send_email(cls, mode: str, user: User | RpcUser, hash: str, extra: dict[str, Any]) -> None: from sentry import options @@ -75,6 +79,7 @@ def _send_email(cls, mode: str, user: User | RpcUser, hash: str, extra: dict[str subject = "Password Recovery" template = "recover_account" if mode == "set_password": + subject = "Set Password for your Sentry.io Account" template = "set_password" elif mode == "relocate_account": template = "relocate_account"