From a332bee2b7f402c2e0e9f8c99336e99b4279f918 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Tue, 5 Feb 2013 16:59:21 -0500 Subject: [PATCH] When inviting users, check if the invitee is in-domain or the realm is open. (imported from commit 42e072d9717f38cc6d0c7010d37bbabd81aa3ae7) --- zephyr/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zephyr/views.py b/zephyr/views.py index d44328f98e..02ff66edb6 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -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