mirror of https://github.com/zulip/zulip.git
When inviting users, check if the invitee is in-domain or the realm is open.
(imported from commit 42e072d9717f38cc6d0c7010d37bbabd81aa3ae7)
This commit is contained in:
parent
aeba3beb55
commit
a332bee2b7
|
@ -324,13 +324,13 @@ def json_invite_users(request, user_profile, invitee_emails=POST):
|
|||
for email in invitee_emails:
|
||||
if email == '':
|
||||
continue
|
||||
try:
|
||||
validators.validate_email(email)
|
||||
except ValidationError:
|
||||
|
||||
if not validators.email_re.match(email):
|
||||
errors.append((email, "Invalid address."))
|
||||
continue
|
||||
|
||||
if email.split('@')[-1] != user_profile.realm.domain:
|
||||
if user_profile.realm.restricted_to_domain and \
|
||||
email.split('@', 1)[-1] != user_profile.realm.domain:
|
||||
errors.append((email, "Outside your domain."))
|
||||
continue
|
||||
|
||||
|
|
Loading…
Reference in New Issue