diff --git a/templates/zerver/realm_creation_form.html b/templates/zerver/realm_creation_form.html index 1dceedbb02..471d5114b8 100644 --- a/templates/zerver/realm_creation_form.html +++ b/templates/zerver/realm_creation_form.html @@ -1,66 +1,70 @@ -
-
- -
- - {% if form.realm_name.errors %} - {% for error in form.realm_name.errors %} -

{{ error }}

- {% endfor %} - {% endif %} - -
- {{ _('Shorter is better than longer.') }} -
-
- -
-
- -
- - -
- -
- - {% if root_domain_available %} - - {% endif %} - -
-
{{ _('OR') }}
+
+
- - -

+
- {% if form.realm_subdomain.errors %} - {% for error in form.realm_subdomain.errors %} -

{{ error }}

+ + {% if form.realm_name.errors %} + {% for error in form.realm_name.errors %} +

{{ error }}

{% endfor %} {% endif %} + + {% if not user_registration_form %} +
+ {{ _('Shorter is better than longer.') }} +
+ {% endif %} +
+ +
+
+ +
+ + +
+ +
+ + {% if root_domain_available %} + + {% endif %} + +
+
{{ _('OR') }}
+
+ + +

+
+ {% if form.realm_subdomain.errors %} + {% for error in form.realm_subdomain.errors %} +

{{ error }}

+ {% endfor %} + {% endif %} +
diff --git a/templates/zerver/register.html b/templates/zerver/register.html index b94ef59fe8..0b0e57db82 100644 --- a/templates/zerver/register.html +++ b/templates/zerver/register.html @@ -24,7 +24,7 @@ Form is validated both client-side using jquery-validation (see signup.js) and s {% endif %} {% trans %} -

You’re almost there! We just need you to do one last thing.

+

Enter your account details to complete registration.

{% endtrans %}
@@ -33,11 +33,31 @@ Form is validated both client-side using jquery-validation (see signup.js) and s
{% if creating_new_realm %} - {{ _('Your organization') }} + {{ _('Your organization') }} + {% if not form.realm_subdomain.errors %} + + {% endif %} + {% with %} {% set user_registration_form = "true" %} {% include 'zerver/realm_creation_form.html' %} {% endwith %} + {% if not form.realm_subdomain.errors %} +
+
+ +
{{ form.realm_name.value() }}
+
+
+ +
{{ selected_realm_type_name }}
+
+
+ +
{% if form.realm_subdomain.value() %}{{ form.realm_subdomain.value() }}.{% endif %}{{external_host}}
+
+
+ {% endif %} {% endif %}
diff --git a/web/e2e-tests/realm-creation.test.ts b/web/e2e-tests/realm-creation.test.ts index cfb70c3dfb..bdfee635ef 100644 --- a/web/e2e-tests/realm-creation.test.ts +++ b/web/e2e-tests/realm-creation.test.ts @@ -48,7 +48,7 @@ async function realm_creation_tests(page: Page): Promise { const text_in_pitch = await page.evaluate( () => document.querySelector(".pitch p")!.textContent, ); - assert.equal(text_in_pitch, "You’re almost there! We just need you to do one last thing."); + assert.equal(text_in_pitch, "Enter your account details to complete registration."); // fill the form. const params = { diff --git a/web/src/portico/signup.js b/web/src/portico/signup.js index dc4510742e..be0cb4a3f8 100644 --- a/web/src/portico/signup.js +++ b/web/src/portico/signup.js @@ -284,4 +284,19 @@ $(() => { } $("#new-user-email-address-visibility .current-selected-option").text(selected_option_text); }); + + $("#registration").on("click keypress", ".edit-realm-details", (e) => { + if (e.type === "keypress" && e.key !== "Enter") { + return; + } + + $("#registration .not-editable-realm-details").addClass("hide"); + $("#registration .realm-creation-editable-inputs").removeClass("hide"); + $("#id_team_name").trigger("focus"); + // This is a hack to have cursor at end after focussing the input. + const name_val = $("#id_team_name").val(); + $("#id_team_name").val("").val(name_val); + + $(e.target).hide(); + }); }); diff --git a/web/styles/portico/portico_signin.css b/web/styles/portico/portico_signin.css index caf212a7d9..291988e491 100644 --- a/web/styles/portico/portico_signin.css +++ b/web/styles/portico/portico_signin.css @@ -1010,7 +1010,8 @@ button#register_auth_button_gitlab { #id_email, #support_from, - #support_realm { + #support_realm, + .not-editable-realm-field { font-weight: normal; margin: 2px; padding-top: 25px; @@ -1047,6 +1048,11 @@ button#register_auth_button_gitlab { + .input-box { margin-top: 20px; } + + .edit-realm-details { + float: right; + cursor: pointer; + } } .center-block .pitch { diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py index 466cb653be..c032d46d8a 100644 --- a/zerver/tests/test_auth_backends.py +++ b/zerver/tests/test_auth_backends.py @@ -1409,7 +1409,7 @@ class SocialAuthBase(DesktopFlowTestingLib, ZulipTestCase, ABC): confirmation_data = {"from_confirmation": "1", "key": confirmation_key} result = self.client_post("/accounts/register/", confirmation_data) if not skip_registration_form: - self.assert_in_response("We just need you to do one last thing", result) + self.assert_in_response("Enter your account details to complete registration.", result) # Verify that the user is asked for name but not password self.assert_not_in_success_response(["id_password"], result) @@ -4282,7 +4282,7 @@ class GoogleAuthBackendTest(SocialAuthBase): "key": confirmation_key, } result = self.client_post("/accounts/register/", confirmation_data, subdomain="zulip") - self.assert_in_response("We just need you to do one last thing", result) + self.assert_in_response("Enter your account details to complete registration.", result) # Verify that the user is asked for name but not password self.assert_not_in_success_response(["id_password"], result) @@ -4318,7 +4318,7 @@ class GoogleAuthBackendTest(SocialAuthBase): "key": confirmation_key, } result = self.client_post("/accounts/register/", confirmation_data, subdomain="zulip") - self.assert_in_response("We just need you to do one last thing", result) + self.assert_in_response("Enter your account details to complete registration.", result) # Verify that the user is asked for name but not password self.assert_not_in_success_response(["id_password"], result) @@ -4372,7 +4372,7 @@ class GoogleAuthBackendTest(SocialAuthBase): self.assert_in_response('action="/accounts/register/"', result) data2 = {"from_confirmation": "1", "full_name": data["full_name"], "key": confirmation_key} result = self.client_post("/accounts/register/", data2, subdomain="zulip") - self.assert_in_response("We just need you to do one last thing", result) + self.assert_in_response("Enter your account details to complete registration.", result) # Verify that the user is asked for name but not password self.assert_not_in_success_response(["id_password"], result) diff --git a/zerver/tests/test_invite.py b/zerver/tests/test_invite.py index 71d34aa4b6..88f558db8c 100644 --- a/zerver/tests/test_invite.py +++ b/zerver/tests/test_invite.py @@ -1436,7 +1436,9 @@ so we didn't send them an invitation. We did send invitations to everyone else!" response = self.client_post( url, {"key": registration_key, "from_confirmation": 1, "full_name": "alice"} ) - self.assert_in_success_response(["We just need you to do one last thing."], response) + self.assert_in_success_response( + ["Enter your account details to complete registration."], response + ) response = self.submit_reg_form_for_user(email, password, key=registration_key) self.assertEqual(response.status_code, 302) diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index 5581285ca8..0097ceaeb5 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -2431,7 +2431,9 @@ class UserSignUpTest(ZulipTestCase): result = self.verify_signup(email=email, password=password, full_name="") # _WSGIPatchedWSGIResponse does not exist in Django, thus the inverted isinstance check. assert not isinstance(result, UserProfile) - self.assert_in_success_response(["We just need you to do one last thing."], result) + self.assert_in_success_response( + ["Enter your account details to complete registration."], result + ) # Verify that the user is asked for name and password self.assert_in_success_response(["id_password", "id_full_name"], result) @@ -2486,7 +2488,9 @@ class UserSignUpTest(ZulipTestCase): "from_confirmation": "1", }, ) - self.assert_in_success_response(["We just need you to do one last thing."], result) + self.assert_in_success_response( + ["Enter your account details to complete registration."], result + ) def test_signup_with_weak_password(self) -> None: """ @@ -2521,7 +2525,9 @@ class UserSignUpTest(ZulipTestCase): "from_confirmation": "1", }, ) - self.assert_in_success_response(["We just need you to do one last thing."], result) + self.assert_in_success_response( + ["Enter your account details to complete registration."], result + ) result = self.submit_reg_form_for_user(email, "easy", full_name="New Guy") self.assert_in_success_response(["The password is too weak."], result) @@ -2588,7 +2594,7 @@ class UserSignUpTest(ZulipTestCase): email, password, full_name="New Guy", from_confirmation="1" ) self.assert_in_success_response( - ["We just need you to do one last thing.", "New Guy", email], result + ["Enter your account details to complete registration.", "New Guy", email], result ) result = self.submit_reg_form_for_user(email, password, full_name="New Guy") user_profile = UserProfile.objects.get(delivery_email=email) @@ -2733,7 +2739,7 @@ class UserSignUpTest(ZulipTestCase): [ "Import settings from existing Zulip account", "selected >\n Zulip Dev", - "We just need you to do one last thing.", + "Enter your account details to complete registration.", ], result, ) @@ -3007,7 +3013,7 @@ class UserSignUpTest(ZulipTestCase): self.assert_in_success_response( [ - "We just need you to do one last thing.", + "Enter your account details to complete registration.", "New LDAP fullname", "newuser@zulip.com", ], @@ -3034,7 +3040,8 @@ class UserSignUpTest(ZulipTestCase): HTTP_HOST=subdomain + ".testserver", ) self.assert_in_success_response( - ["We just need you to do one last thing.", "newuser@zulip.com"], result + ["Enter your account details to complete registration.", "newuser@zulip.com"], + result, ) @override_settings( @@ -3096,7 +3103,7 @@ class UserSignUpTest(ZulipTestCase): self.assert_in_success_response( [ - "We just need you to do one last thing.", + "Enter your account details to complete registration.", "New LDAP fullname", "newuser@zulip.com", ], @@ -3159,7 +3166,12 @@ class UserSignUpTest(ZulipTestCase): # Full name should be set from LDAP self.assert_in_success_response( - ["We just need you to do one last thing.", full_name, "newuser@zulip.com"], result + [ + "Enter your account details to complete registration.", + full_name, + "newuser@zulip.com", + ], + result, ) # Submit the final form with the wrong password. @@ -3821,7 +3833,8 @@ class UserSignUpTest(ZulipTestCase): HTTP_HOST=subdomain + ".testserver", ) self.assert_in_success_response( - ["We just need you to do one last thing.", "newuser@zulip.com"], result + ["Enter your account details to complete registration.", "newuser@zulip.com"], + result, ) @patch( diff --git a/zerver/views/registration.py b/zerver/views/registration.py index a72d712fa1..55b540d0c2 100644 --- a/zerver/views/registration.py +++ b/zerver/views/registration.py @@ -72,6 +72,7 @@ from zerver.models import ( Stream, UserProfile, get_default_stream_groups, + get_org_type_display_name, get_realm, get_source_profile, get_user_by_delivery_email, @@ -177,6 +178,14 @@ def check_prereg_key( return prereg_object, realm_creation +def get_selected_realm_type_name(prereg_realm: Optional[PreregistrationRealm]) -> Optional[str]: + if prereg_realm is None: + # We show the selected realm type only when creating new realm. + return None + + return get_org_type_display_name(prereg_realm.org_type) + + @add_google_analytics @require_post def realm_register(*args: Any, **kwargs: Any) -> HttpResponse: @@ -597,6 +606,7 @@ def registration_helper( Realm.ORG_TYPES.values(), key=lambda d: d["display_order"] ), "default_email_address_visibility": default_email_address_visibility, + "selected_realm_type_name": get_selected_realm_type_name(prereg_realm), "email_address_visibility_admins_only": RealmUserDefault.EMAIL_ADDRESS_VISIBILITY_ADMINS, "email_address_visibility_moderators": RealmUserDefault.EMAIL_ADDRESS_VISIBILITY_MODERATORS, "email_address_visibility_nobody": RealmUserDefault.EMAIL_ADDRESS_VISIBILITY_NOBODY,