registration: Remove organization type selection in realm creation.

This commit is contained in:
Jack Zhang
2017-06-26 15:07:42 -07:00
committed by Tim Abbott
parent 7f96b3ef2f
commit e915321f89
5 changed files with 8 additions and 53 deletions

View File

@@ -135,43 +135,6 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="input-group m-10 inline-block">
<label for="id_org_type" class="label-title">{{ _('Organization type') }}</label>
{% for org_type_value, org_type_text in form.realm_org_type.field.choices %}
<div class="input-group radio">
<input id="id_radio_{{ org_type_value }}" class="required inline-block" type="radio"
name="realm_org_type" value="{{ org_type_value }}"
{% if org_type_value|string == form.realm_org_type.value()|string %} checked {% endif %} />
<label for="id_radio_{{ org_type_value }}" class="inline-block">{{ org_type_text }}</label>
</div>
{% endfor %}
</div>
<div class="m-10">
<div class="help-box">
<div id="org_type_blob_1" class="blob display-none">
{% trans %}
Create a corporate organization if your users will be members of the
same company, where the privacy expectation is that the company's
organization administrators may need to have access to your users'
private message history. Zulip features that allow organization
administrators to take control of accounts or access private message
history for other users are only available to corporate organizations.
{% endtrans %}
</div>
<div id="org_type_blob_2" class="blob">
{% trans %}
Create a community organization for an open source project, social
group, or other community where the privacy expectation is that you
and other organization administrators won't have access to your users'
private message history. Zulip features that allow organization
administrators to take control of accounts or access private message
history for other users are disabled in community organizations.
{% endtrans %}
</div>
</div>
</div>
{% endif %} {% endif %}
<div class="input-group margin terms-of-service"> <div class="input-group margin terms-of-service">
@@ -217,10 +180,11 @@ if ($('#id_email').length === 1) {
common.autofocus('#id_full_name'); common.autofocus('#id_full_name');
} }
$("[name=realm_org_type]").on("change", function () { // reset error message displays
$(".blob").hide(); $('#id_team_subdomain_error_client').css('display', 'none');
$("#org_type_blob_" + this.value).show(); if ($('.team_subdomain_error_server').text() === '') {
}); $('.team_subdomain_error_server').css('display', 'none');
}
$("#timezone").val(moment.tz.guess()); $("#timezone").val(moment.tz.guess());
</script> </script>

View File

@@ -58,9 +58,6 @@ class RegistrationForm(forms.Form):
password = forms.CharField(widget=forms.PasswordInput, max_length=MAX_PASSWORD_LENGTH, password = forms.CharField(widget=forms.PasswordInput, max_length=MAX_PASSWORD_LENGTH,
required=False) required=False)
realm_subdomain = forms.CharField(max_length=Realm.MAX_REALM_SUBDOMAIN_LENGTH, required=False) realm_subdomain = forms.CharField(max_length=Realm.MAX_REALM_SUBDOMAIN_LENGTH, required=False)
realm_org_type = forms.ChoiceField(((Realm.COMMUNITY, 'Community'),
(Realm.CORPORATE, 'Corporate')),
initial=Realm.CORPORATE, required=False)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
# type: (*Any, **Any) -> None # type: (*Any, **Any) -> None

View File

@@ -281,9 +281,9 @@ class ZulipTestCase(TestCase):
return self.submit_reg_form_for_user(email, password) return self.submit_reg_form_for_user(email, password)
def submit_reg_form_for_user(self, email, password, realm_name="Zulip Test", def submit_reg_form_for_user(self, email, password, realm_name="Zulip Test",
realm_subdomain="zuliptest", realm_org_type=Realm.CORPORATE, realm_subdomain="zuliptest",
from_confirmation='', full_name=None, timezone=u'', **kwargs): from_confirmation='', full_name=None, timezone=u'', **kwargs):
# type: (Text, Text, Optional[Text], Optional[Text], int, Optional[Text], Optional[Text], Optional[Text], **Any) -> HttpResponse # type: (Text, Text, Optional[Text], Optional[Text], Optional[Text], Optional[Text], Optional[Text], **Any) -> HttpResponse
""" """
Stage two of the two-step registration process. Stage two of the two-step registration process.
@@ -300,7 +300,6 @@ class ZulipTestCase(TestCase):
'realm_name': realm_name, 'realm_name': realm_name,
'realm_subdomain': realm_subdomain, 'realm_subdomain': realm_subdomain,
'key': find_key_by_email(email), 'key': find_key_by_email(email),
'realm_org_type': realm_org_type,
'timezone': timezone, 'timezone': timezone,
'terms': True, 'terms': True,
'from_confirmation': from_confirmation}, 'from_confirmation': from_confirmation},

View File

@@ -1089,7 +1089,6 @@ class UserSignUpTest(ZulipTestCase):
'realm_name': 'Zulip Test', 'realm_name': 'Zulip Test',
'realm_subdomain': 'zuliptest', 'realm_subdomain': 'zuliptest',
'key': find_key_by_email(email), 'key': find_key_by_email(email),
'realm_org_type': Realm.CORPORATE,
'terms': True}) 'terms': True})
# User should now be logged in. # User should now be logged in.
@@ -1124,7 +1123,6 @@ class UserSignUpTest(ZulipTestCase):
'realm_name': 'Zulip Test', 'realm_name': 'Zulip Test',
'realm_subdomain': 'zuliptest', 'realm_subdomain': 'zuliptest',
'key': find_key_by_email(email), 'key': find_key_by_email(email),
'realm_org_type': Realm.CORPORATE,
'terms': True, 'terms': True,
'from_confirmation': '1'}) 'from_confirmation': '1'})
self.assert_in_success_response(["You're almost there."], result) self.assert_in_success_response(["You're almost there."], result)
@@ -1156,7 +1154,6 @@ class UserSignUpTest(ZulipTestCase):
'realm_name': 'Zulip Test', 'realm_name': 'Zulip Test',
'realm_subdomain': 'zuliptest', 'realm_subdomain': 'zuliptest',
'key': find_key_by_email(email), 'key': find_key_by_email(email),
'realm_org_type': Realm.CORPORATE,
'terms': True, 'terms': True,
'full_name': "New Guy", 'full_name': "New Guy",
'from_confirmation': '1'}) 'from_confirmation': '1'})
@@ -1197,7 +1194,6 @@ class UserSignUpTest(ZulipTestCase):
'realm_name': 'Zulip Test', 'realm_name': 'Zulip Test',
'realm_subdomain': 'zuliptest', 'realm_subdomain': 'zuliptest',
'key': find_key_by_email(email), 'key': find_key_by_email(email),
'realm_org_type': Realm.CORPORATE,
'terms': True}) 'terms': True})
mock_error.assert_called_once() mock_error.assert_called_once()
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)

View File

@@ -202,8 +202,7 @@ def accounts_register(request):
if realm_creation: if realm_creation:
string_id = form.cleaned_data['realm_subdomain'] string_id = form.cleaned_data['realm_subdomain']
realm_name = form.cleaned_data['realm_name'] realm_name = form.cleaned_data['realm_name']
org_type = int(form.cleaned_data['realm_org_type']) realm = do_create_realm(string_id, realm_name)[0]
realm = do_create_realm(string_id, realm_name, org_type=org_type)[0]
stream_info = settings.DEFAULT_NEW_REALM_STREAMS stream_info = settings.DEFAULT_NEW_REALM_STREAMS