accounts_send_confirm: Show email to which the link was sent.

This can be useful for the user in case user is worried if they
typed the correct email.
This commit is contained in:
Aman Agrawal 2023-01-19 11:56:45 +00:00 committed by Tim Abbott
parent 1a400b21e7
commit a51bf96c70
2 changed files with 31 additions and 31 deletions

View File

@ -18,7 +18,7 @@ page can be easily identified in it's respective JavaScript file -->
</div> </div>
<div class="white-box"> <div class="white-box">
<p>{{ _("Check your email so we can get started.") }}</p> <p>{% trans %}Check your email (<span class="semi-bold">{{ email }}</span>) so we can get started.{% endtrans %}</p>
{% include 'zerver/dev_env_email_access_details.html' %} {% include 'zerver/dev_env_email_access_details.html' %}

View File

@ -3024,7 +3024,7 @@ class MultiuseInviteTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
result = self.client_get(confirmation_url) result = self.client_get(confirmation_url)
@ -3398,7 +3398,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Check confirmation email has the correct subject and body, extract # Check confirmation email has the correct subject and body, extract
# confirmation link and visit it # confirmation link and visit it
@ -3509,7 +3509,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -3549,7 +3549,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -3592,7 +3592,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -3646,7 +3646,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -3685,7 +3685,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -3720,7 +3720,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -3758,7 +3758,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
result = self.client_get(confirmation_url) result = self.client_get(confirmation_url)
@ -3806,7 +3806,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
first_confirmation_url = self.get_confirmation_url_from_outbox(email) first_confirmation_url = self.get_confirmation_url_from_outbox(email)
self.assertEqual(PreregistrationUser.objects.filter(email=email, status=0).count(), 1) self.assertEqual(PreregistrationUser.objects.filter(email=email, status=0).count(), 1)
@ -3815,7 +3815,7 @@ class RealmCreationTest(ZulipTestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/new/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
second_confirmation_url = self.get_confirmation_url_from_outbox(email) second_confirmation_url = self.get_confirmation_url_from_outbox(email)
self.assertNotEqual(first_confirmation_url, second_confirmation_url) self.assertNotEqual(first_confirmation_url, second_confirmation_url)
@ -4074,7 +4074,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"], **client_kwargs) result = self.client_get(result["Location"], **client_kwargs)
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -4151,7 +4151,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -4182,7 +4182,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -4216,7 +4216,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -4309,7 +4309,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
from django.core.mail import outbox from django.core.mail import outbox
@ -4327,7 +4327,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -4357,7 +4357,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -4628,7 +4628,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
confirmation_url = self.get_confirmation_url_from_outbox(email) confirmation_url = self.get_confirmation_url_from_outbox(email)
@ -4819,7 +4819,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
from django.core.mail import outbox from django.core.mail import outbox
@ -4902,7 +4902,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
from django.core.mail import outbox from django.core.mail import outbox
@ -4977,7 +4977,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
with self.settings( with self.settings(
POPULATE_PROFILE_VIA_LDAP=True, POPULATE_PROFILE_VIA_LDAP=True,
@ -5044,7 +5044,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
with self.settings( with self.settings(
POPULATE_PROFILE_VIA_LDAP=True, POPULATE_PROFILE_VIA_LDAP=True,
@ -5190,7 +5190,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
with self.settings( with self.settings(
POPULATE_PROFILE_VIA_LDAP=True, POPULATE_PROFILE_VIA_LDAP=True,
@ -5241,7 +5241,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# If the user's email is inside the LDAP directory and we just # If the user's email is inside the LDAP directory and we just
# have a wrong password, then we refuse to create an account # have a wrong password, then we refuse to create an account
@ -5363,7 +5363,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
with self.settings( with self.settings(
POPULATE_PROFILE_VIA_LDAP=True, POPULATE_PROFILE_VIA_LDAP=True,
@ -5404,7 +5404,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
with self.settings( with self.settings(
POPULATE_PROFILE_VIA_LDAP=True, POPULATE_PROFILE_VIA_LDAP=True,
LDAP_EMAIL_ATTR="mail", LDAP_EMAIL_ATTR="mail",
@ -5555,7 +5555,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
with patch("zerver.views.registration.name_changes_disabled", return_value=True): with patch("zerver.views.registration.name_changes_disabled", return_value=True):
result = self.submit_reg_form_for_user( result = self.submit_reg_form_for_user(
@ -5584,7 +5584,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"]) result = self.client_get(result["Location"])
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
from django.core.mail import outbox from django.core.mail import outbox
@ -5645,7 +5645,7 @@ class UserSignUpTest(InviteUserBase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}")) self.assertTrue(result["Location"].endswith(f"/accounts/send_confirm/{email}"))
result = self.client_get(result["Location"], subdomain="zephyr") result = self.client_get(result["Location"], subdomain="zephyr")
self.assert_in_response("Check your email so we can get started.", result) self.assert_in_response("Check your email", result)
# Visit the confirmation link. # Visit the confirmation link.
from django.core.mail import outbox from django.core.mail import outbox