mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
urls: Provide email as a GET parameter.
Since we want to use `accounts/new/send_confirm` to know how many users actually register after visiting the register page, we added it to Google Tag Manager, but GTM tracks every user registration separately due <email> in the URL making it harder to track. To solve this, we want to pass <email> as a GET parameter which can be easily filtered inside GTM using a RegEx and all the registrations can be tracked as one.
This commit is contained in:
@@ -21,7 +21,7 @@ async function realm_creation_tests(page: Page): Promise<void> {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Make sure confirmation email is sent.
|
// Make sure confirmation email is sent.
|
||||||
assert.ok(page.url().includes("/accounts/new/send_confirm/" + email));
|
assert.ok(page.url().includes("/accounts/new/send_confirm/?email=alice%40test.example.com"));
|
||||||
|
|
||||||
// Special endpoint enabled only during tests for extracting confirmation key
|
// Special endpoint enabled only during tests for extracting confirmation key
|
||||||
await page.goto("http://" + host + "/confirmation_key/");
|
await page.goto("http://" + host + "/confirmation_key/");
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ $(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Code in this block will be executed when the /accounts/send_confirm
|
// Code in this block will be executed when the /accounts/send_confirm/
|
||||||
// endpoint is visited i.e. accounts_send_confirm.html is rendered.
|
// endpoint is visited i.e. accounts_send_confirm.html is rendered.
|
||||||
if ($("[data-page-id='accounts-send-confirm']").length > 0) {
|
if ($("[data-page-id='accounts-send-confirm']").length > 0) {
|
||||||
$("#resend_email_link").on("click", () => {
|
$("#resend_email_link").on("click", () => {
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ html {
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.semi-bold {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
.white-box {
|
.white-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
|
|||||||
@@ -733,7 +733,9 @@ Output:
|
|||||||
def register(self, email: str, password: str, subdomain: str = DEFAULT_SUBDOMAIN) -> None:
|
def register(self, email: str, password: str, subdomain: str = DEFAULT_SUBDOMAIN) -> None:
|
||||||
response = self.client_post("/accounts/home/", {"email": email}, subdomain=subdomain)
|
response = self.client_post("/accounts/home/", {"email": email}, subdomain=subdomain)
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.assertEqual(response["Location"], f"/accounts/send_confirm/{email}")
|
self.assertEqual(
|
||||||
|
response["Location"], f"/accounts/send_confirm/?email={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
response = self.submit_reg_form_for_user(email, password, subdomain=subdomain)
|
response = self.submit_reg_form_for_user(email, password, subdomain=subdomain)
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
self.assertEqual(response["Location"], f"http://{Realm.host_for_subdomain(subdomain)}/")
|
self.assertEqual(response["Location"], f"http://{Realm.host_for_subdomain(subdomain)}/")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import urllib
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
from unittest import mock, skipUnless
|
from unittest import mock, skipUnless
|
||||||
@@ -318,9 +319,11 @@ class TestGenerateRealmCreationLink(ZulipTestCase):
|
|||||||
|
|
||||||
result = self.client_post(generated_link, {"email": email})
|
result = self.client_post(generated_link, {"email": email})
|
||||||
self.assertEqual(result.status_code, 302)
|
self.assertEqual(result.status_code, 302)
|
||||||
self.assertTrue(re.search(f"/accounts/new/send_confirm/{email}$", result["Location"]))
|
self.assertEqual(
|
||||||
|
f"/accounts/new/send_confirm/?email={urllib.parse.quote(email)}", result["Location"]
|
||||||
|
)
|
||||||
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)
|
||||||
|
|
||||||
# Original link is now dead
|
# Original link is now dead
|
||||||
result = self.client_get(generated_link)
|
result = self.client_get(generated_link)
|
||||||
|
|||||||
@@ -774,10 +774,10 @@ class PasswordResetTest(ZulipTestCase):
|
|||||||
result = self.client_get("/accounts/password/done/")
|
result = self.client_get("/accounts/password/done/")
|
||||||
self.assert_in_success_response(["We've reset your password!"], result)
|
self.assert_in_success_response(["We've reset your password!"], result)
|
||||||
|
|
||||||
result = self.client_get("/accounts/send_confirm/alice@example.com")
|
result = self.client_get("/accounts/send_confirm/?email=alice@example.com")
|
||||||
self.assert_in_success_response(["/accounts/home/"], result)
|
self.assert_in_success_response(["/accounts/home/"], result)
|
||||||
|
|
||||||
result = self.client_get("/accounts/new/send_confirm/alice@example.com")
|
result = self.client_get("/accounts/new/send_confirm/?email=alice@example.com")
|
||||||
self.assert_in_success_response(["/new/"], result)
|
self.assert_in_success_response(["/new/"], result)
|
||||||
|
|
||||||
def test_password_reset_for_soft_deactivated_user(self) -> None:
|
def test_password_reset_for_soft_deactivated_user(self) -> None:
|
||||||
@@ -3022,7 +3022,11 @@ class MultiuseInviteTest(ZulipTestCase):
|
|||||||
|
|
||||||
result = self.client_post(invite_link, {"email": email})
|
result = self.client_post(invite_link, {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3396,7 +3400,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3507,7 +3515,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3547,7 +3559,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3590,7 +3606,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3644,7 +3664,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3683,7 +3707,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3718,7 +3746,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Create new realm with the email
|
# Create new realm with the email
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3756,7 +3788,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
|
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -3804,7 +3840,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Now we pre-generate two realm creation links
|
# Now we pre-generate two realm creation links
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", 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)
|
||||||
@@ -3813,7 +3853,11 @@ class RealmCreationTest(ZulipTestCase):
|
|||||||
# Get a second realm creation link.
|
# Get a second realm creation link.
|
||||||
result = self.client_post("/new/", {"email": email})
|
result = self.client_post("/new/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", 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)
|
||||||
@@ -4072,7 +4116,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email}, **client_kwargs)
|
result = self.client_post("/accounts/home/", {"email": email}, **client_kwargs)
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"], **client_kwargs)
|
result = self.client_get(result["Location"], **client_kwargs)
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4149,7 +4197,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email})
|
result = self.client_post("/accounts/home/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4180,7 +4232,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email})
|
result = self.client_post("/accounts/home/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4214,7 +4270,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email})
|
result = self.client_post("/accounts/home/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4307,7 +4367,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email})
|
result = self.client_post("/accounts/home/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4325,7 +4389,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email})
|
result = self.client_post("/accounts/home/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4355,7 +4423,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email})
|
result = self.client_post("/accounts/home/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4626,7 +4698,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
|
|
||||||
result = self.client_post("/accounts/home/", {"email": email})
|
result = self.client_post("/accounts/home/", {"email": email})
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -4817,7 +4893,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
# Visit the confirmation link.
|
# Visit the confirmation link.
|
||||||
@@ -4900,7 +4980,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
# Visit the confirmation link.
|
# Visit the confirmation link.
|
||||||
@@ -4975,7 +5059,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -5042,7 +5130,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -5188,7 +5280,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -5239,7 +5335,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -5361,7 +5461,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -5402,7 +5506,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
with self.settings(
|
with self.settings(
|
||||||
@@ -5553,7 +5661,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
|
|
||||||
@@ -5582,7 +5694,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email})
|
result = self.client_post("/register/", {"email": email})
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"])
|
result = self.client_get(result["Location"])
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
# Visit the confirmation link.
|
# Visit the confirmation link.
|
||||||
@@ -5643,7 +5759,11 @@ class UserSignUpTest(InviteUserBase):
|
|||||||
result = self.client_post("/register/", {"email": email}, subdomain="zephyr")
|
result = self.client_post("/register/", {"email": email}, subdomain="zephyr")
|
||||||
|
|
||||||
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={urllib.parse.quote(email)}"
|
||||||
|
)
|
||||||
|
)
|
||||||
result = self.client_get(result["Location"], subdomain="zephyr")
|
result = self.client_get(result["Location"], subdomain="zephyr")
|
||||||
self.assert_in_response("Check your email", result)
|
self.assert_in_response("Check your email", result)
|
||||||
# Visit the confirmation link.
|
# Visit the confirmation link.
|
||||||
|
|||||||
@@ -655,7 +655,10 @@ def create_realm(request: HttpRequest, creation_key: Optional[str] = None) -> Ht
|
|||||||
|
|
||||||
if key_record is not None:
|
if key_record is not None:
|
||||||
key_record.delete()
|
key_record.delete()
|
||||||
return HttpResponseRedirect(reverse("new_realm_send_confirm", kwargs={"email": email}))
|
new_realm_send_confirm_url = reverse("new_realm_send_confirm")
|
||||||
|
query = urlencode({"email": email})
|
||||||
|
url = append_url_query_string(new_realm_send_confirm_url, query)
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
form = RealmCreationForm()
|
form = RealmCreationForm()
|
||||||
return TemplateResponse(
|
return TemplateResponse(
|
||||||
@@ -665,8 +668,18 @@ def create_realm(request: HttpRequest, creation_key: Optional[str] = None) -> Ht
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@has_request_variables
|
||||||
|
def signup_send_confirm(request: HttpRequest, email: str = REQ("email")) -> HttpResponse:
|
||||||
|
return TemplateResponse(
|
||||||
|
request,
|
||||||
|
"zerver/accounts_send_confirm.html",
|
||||||
|
context={"email": email},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@add_google_analytics
|
@add_google_analytics
|
||||||
def new_realm_send_confirm(request: HttpRequest, email: str) -> HttpResponse:
|
@has_request_variables
|
||||||
|
def new_realm_send_confirm(request: HttpRequest, email: str = REQ("email")) -> HttpResponse:
|
||||||
return TemplateResponse(
|
return TemplateResponse(
|
||||||
request,
|
request,
|
||||||
"zerver/accounts_send_confirm.html",
|
"zerver/accounts_send_confirm.html",
|
||||||
@@ -739,8 +752,10 @@ def accounts_home(
|
|||||||
except EmailNotDeliveredError:
|
except EmailNotDeliveredError:
|
||||||
logging.error("Error in accounts_home")
|
logging.error("Error in accounts_home")
|
||||||
return HttpResponseRedirect("/config-error/smtp")
|
return HttpResponseRedirect("/config-error/smtp")
|
||||||
|
signup_send_confirm_url = reverse("signup_send_confirm")
|
||||||
return HttpResponseRedirect(reverse("signup_send_confirm", kwargs={"email": email}))
|
query = urlencode({"email": email})
|
||||||
|
url = append_url_query_string(signup_send_confirm_url, query)
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
form = HomepageForm(realm=realm)
|
form = HomepageForm(realm=realm)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from django.contrib.auth.views import (
|
|||||||
from django.urls import path, re_path
|
from django.urls import path, re_path
|
||||||
from django.urls.resolvers import URLPattern, URLResolver
|
from django.urls.resolvers import URLPattern, URLResolver
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
from django.views.generic import RedirectView, TemplateView
|
from django.views.generic import RedirectView
|
||||||
|
|
||||||
from zerver.forms import LoggingSetPasswordForm
|
from zerver.forms import LoggingSetPasswordForm
|
||||||
from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
|
from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
|
||||||
@@ -126,6 +126,7 @@ from zerver.views.registration import (
|
|||||||
get_prereg_key_and_redirect,
|
get_prereg_key_and_redirect,
|
||||||
new_realm_send_confirm,
|
new_realm_send_confirm,
|
||||||
realm_redirect,
|
realm_redirect,
|
||||||
|
signup_send_confirm,
|
||||||
)
|
)
|
||||||
from zerver.views.report import (
|
from zerver.views.report import (
|
||||||
report_csp_violations,
|
report_csp_violations,
|
||||||
@@ -565,12 +566,12 @@ i18n_urls = [
|
|||||||
# Registration views, require a confirmation ID.
|
# Registration views, require a confirmation ID.
|
||||||
path("accounts/home/", accounts_home),
|
path("accounts/home/", accounts_home),
|
||||||
path(
|
path(
|
||||||
"accounts/send_confirm/<email>",
|
"accounts/send_confirm/",
|
||||||
TemplateView.as_view(template_name="zerver/accounts_send_confirm.html"),
|
signup_send_confirm,
|
||||||
name="signup_send_confirm",
|
name="signup_send_confirm",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"accounts/new/send_confirm/<email>",
|
"accounts/new/send_confirm/",
|
||||||
new_realm_send_confirm,
|
new_realm_send_confirm,
|
||||||
name="new_realm_send_confirm",
|
name="new_realm_send_confirm",
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user