mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 12:33:40 +00:00
Allow MIT to invite coworkers.
(imported from commit 273b3abdd3dcc49c01c1a04001450983d4acb000)
This commit is contained in:
@@ -23,10 +23,6 @@ SIGNUP_STRING = '<a href="https://zulip.com/signup">Sign up</a> to find out when
|
||||
def has_valid_realm(value):
|
||||
return Realm.objects.filter(domain=value.split("@")[-1]).exists()
|
||||
|
||||
def isnt_mit(value):
|
||||
if "@mit.edu" in value:
|
||||
raise ValidationError(mark_safe(u'Zulip for MIT is by invitation only. ' + SIGNUP_STRING))
|
||||
|
||||
def not_mit_mailing_list(value):
|
||||
# I don't want ec-discuss signed up for Zulip
|
||||
if "@mit.edu" in value:
|
||||
|
||||
@@ -1757,12 +1757,6 @@ def do_invite_users(user_profile, invitee_emails, streams):
|
||||
errors.append((email, "Outside your domain."))
|
||||
continue
|
||||
|
||||
# Redundant check in case earlier validation preventing MIT users from
|
||||
# inviting people fails.
|
||||
if "@mit.edu" in email:
|
||||
errors.append((email, "Invitations are not enabled for MIT at this time."))
|
||||
continue
|
||||
|
||||
try:
|
||||
user_email_is_unique(email)
|
||||
except ValidationError:
|
||||
|
||||
@@ -40,7 +40,7 @@ from zerver.lib.actions import do_remove_subscription, bulk_remove_subscriptions
|
||||
update_user_activity_interval, do_set_muted_topics, do_rename_stream
|
||||
from zerver.lib.create_user import random_api_key
|
||||
from zerver.forms import RegistrationForm, HomepageForm, ToSForm, CreateBotForm, \
|
||||
is_inactive, isnt_mit, not_mit_mailing_list
|
||||
is_inactive, not_mit_mailing_list
|
||||
from django.views.decorators.csrf import csrf_exempt, csrf_protect
|
||||
from django_openid_auth.views import default_render_failure, login_complete
|
||||
from openid.consumer.consumer import SUCCESS as openid_SUCCESS
|
||||
@@ -460,12 +460,6 @@ def api_endpoint_docs(request):
|
||||
@authenticated_json_post_view
|
||||
@has_request_variables
|
||||
def json_invite_users(request, user_profile, invitee_emails=REQ):
|
||||
# Validation
|
||||
try:
|
||||
isnt_mit(user_profile.email)
|
||||
except ValidationError, e:
|
||||
return json_error(e.message)
|
||||
|
||||
if not invitee_emails:
|
||||
return json_error("You must specify at least one email address.")
|
||||
|
||||
@@ -717,12 +711,7 @@ def home(request):
|
||||
))
|
||||
|
||||
statsd.incr('views.home')
|
||||
|
||||
try:
|
||||
isnt_mit(user_profile.email)
|
||||
show_invites = True
|
||||
except ValidationError:
|
||||
show_invites = False
|
||||
show_invites = True
|
||||
|
||||
# For the CUSTOMER4 student realm, only let instructors (who have
|
||||
# @customer4.invalid addresses) invite new users.
|
||||
|
||||
Reference in New Issue
Block a user