-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relocation): Improve claim user emails (#68495)
We make two changes here: 1. The "claim this user" email now lists the slugs of the new relocation, rather than the one being imported from self-hosted. If there was no import collision, these are one and the same, but in cases of collision (or multiple imports) it makes the email easier to parse. 2. The page for expired lost password hashes has been given custom copy for the unclaimed user case. Now, it tells you specifically that it will resend the "claim user" email, rather than a cryptic "reset password" button. Further, it resends the email directly, rather than making you type in your password again.
- Loading branch information
1 parent
f915116
commit d38e564
Showing
9 changed files
with
278 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends "sentry/bases/auth.html" %} | ||
|
||
{% load crispy_forms_tags %} | ||
{% load i18n %} | ||
|
||
{% block title %}{% trans "Claim Account" %} | {{ block.super }}{% endblock %} | ||
|
||
{% block auth_main %} | ||
<h3>{% trans "Claim Account" %}</h3> | ||
|
||
<p>This account has already been claimed - you should be able to log in as normal. You can always <a href="{% url 'sentry-account-recover' %}">reset your password</a> if you have forgotten it.</p> | ||
{% endblock %} |
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,14 @@ | ||
{% extends "sentry/bases/auth.html" %} | ||
|
||
{% load crispy_forms_tags %} | ||
{% load i18n %} | ||
|
||
{% block title %}{% trans "Claim Account" %} | {{ block.super }}{% endblock %} | ||
|
||
{% block auth_main %} | ||
<h3>{% trans "Claim Account" %}</h3> | ||
|
||
<p>{% blocktrans %}We were unable to locate this account.{% endblocktrans %}</p> | ||
|
||
<p>Please <a href="https://help.sentry.io">contact support</a> for further assistance if necessary.</p> | ||
{% endblock %} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends "sentry/bases/auth.html" %} | ||
|
||
{% load crispy_forms_tags %} | ||
{% load i18n %} | ||
|
||
{% block title %}{% trans "Claim Account" %} | {{ block.super }}{% endblock %} | ||
|
||
{% block auth_main %} | ||
<h3>{% trans "Claim Account" %}</h3> | ||
|
||
<p>{% blocktrans %}We have sent an email to the address registered with this account containing further instructions to set your password and claim this account.{% endblocktrans %}</p> | ||
{% endblock %} |
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 |
---|---|---|
|
@@ -98,6 +98,17 @@ class FakeCloudBuildClient: | |
class RelocationTaskTestCase(TestCase): | ||
def setUp(self): | ||
super().setUp() | ||
|
||
# Create a collision with the org slug we'll be requesting. | ||
self.requested_org_slug = "testing" | ||
self.existing_org_owner = self.create_user( | ||
email="[email protected]", | ||
is_superuser=False, | ||
is_staff=False, | ||
is_active=True, | ||
) | ||
self.existing_org = self.create_organization(name=self.requested_org_slug) | ||
|
||
self.owner = self.create_user( | ||
email="[email protected]", is_superuser=False, is_staff=False, is_active=True | ||
) | ||
|
@@ -1859,11 +1870,20 @@ def setUp(self): | |
printer=Printer(), | ||
) | ||
|
||
self.imported_users = ControlImportChunkReplica.objects.get( | ||
import_uuid=self.uuid, model="sentry.user" | ||
self.imported_orgs = sorted( | ||
RegionImportChunk.objects.get( | ||
import_uuid=self.uuid, model="sentry.organization" | ||
).inserted_identifiers.values() | ||
) | ||
assert len(self.imported_orgs) == 1 | ||
assert ( | ||
len( | ||
ControlImportChunkReplica.objects.get( | ||
import_uuid=self.uuid, model="sentry.user" | ||
).inserted_map | ||
) | ||
== 2 | ||
) | ||
|
||
assert len(self.imported_users.inserted_map) == 2 | ||
|
||
def test_success( | ||
self, | ||
|
@@ -1881,8 +1901,8 @@ def test_success( | |
mock_relocation_email.call_args_list[0][0][0].username, | ||
mock_relocation_email.call_args_list[1][0][0].username, | ||
] | ||
assert mock_relocation_email.call_args_list[0][0][2] == ["testing"] | ||
assert mock_relocation_email.call_args_list[1][0][2] == ["testing"] | ||
assert sorted(mock_relocation_email.call_args_list[0][0][2]) == self.imported_orgs | ||
assert sorted(mock_relocation_email.call_args_list[1][0][2]) == self.imported_orgs | ||
assert "[email protected]" in email_targets | ||
assert "[email protected]" in email_targets | ||
|
||
|
@@ -1969,6 +1989,18 @@ def setUp(self): | |
self.relocation.latest_task = OrderedTask.NOTIFYING_USERS.name | ||
self.relocation.save() | ||
|
||
RegionImportChunk.objects.create( | ||
import_uuid=self.relocation.uuid, | ||
model="sentry.organization", | ||
min_ordinal=0, | ||
max_ordinal=0, | ||
min_source_pk=1, | ||
max_source_pk=1, | ||
inserted_map={1: 1234}, | ||
inserted_identifiers={1: "testing-ab"}, | ||
) | ||
self.imported_orgs = ["testing-ab"] | ||
|
||
def test_success_admin_assisted_relocation( | ||
self, | ||
completed_mock: Mock, | ||
|
@@ -1980,6 +2012,7 @@ def test_success_admin_assisted_relocation( | |
|
||
assert fake_message_builder.call_count == 1 | ||
assert fake_message_builder.call_args.kwargs["type"] == "relocation.succeeded" | ||
assert fake_message_builder.call_args.kwargs["context"]["orgs"] == self.imported_orgs | ||
fake_message_builder.return_value.send_async.assert_called_once_with( | ||
to=[self.owner.email, self.superuser.email] | ||
) | ||
|
@@ -2002,6 +2035,7 @@ def test_success_self_serve_relocation( | |
|
||
assert fake_message_builder.call_count == 1 | ||
assert fake_message_builder.call_args.kwargs["type"] == "relocation.succeeded" | ||
assert fake_message_builder.call_args.kwargs["context"]["orgs"] == self.imported_orgs | ||
fake_message_builder.return_value.send_async.assert_called_once_with(to=[self.owner.email]) | ||
|
||
assert completed_mock.call_count == 1 | ||
|
Oops, something went wrong.