From 00f49d412172e4ef62f64d301c9b0b3ad99df8b5 Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Mon, 13 Mar 2017 09:37:01 -0700 Subject: [PATCH] views/users.py: Change error message to use Realm.string_id instead of domain. --- tools/lint-all | 2 +- zerver/tests/test_users.py | 2 +- zerver/views/users.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/lint-all b/tools/lint-all index 27993359b9..16f3ed2caa 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -309,7 +309,7 @@ def build_custom_checkers(by_lang): ]), 'exclude_line': set([ ('zerver/views/users.py', - "return json_error(_(\"Email '%(email)s' does not belong to domain '%(domain)s'\") %"), + "return json_error(_(\"Email '%(email)s' not allowed for realm '%(realm)s'\") %"), ('zproject/settings.py', "'format': '%(asctime)s %(levelname)-8s %(message)s'"), ]), diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.py index 4f916a0554..e26055e9e1 100644 --- a/zerver/tests/test_users.py +++ b/zerver/tests/test_users.py @@ -211,7 +211,7 @@ class AdminCreateUserTest(ZulipTestCase): short_name='Romeo', )) self.assert_json_error(result, - "Email 'romeo@not-zulip.com' does not belong to domain 'zulip.com'") + "Email 'romeo@not-zulip.com' not allowed for realm 'zulip'") RealmAlias.objects.create(realm=get_realm('zulip'), domain='zulip.net') diff --git a/zerver/views/users.py b/zerver/views/users.py index 189130e2be..a7267d96ae 100644 --- a/zerver/views/users.py +++ b/zerver/views/users.py @@ -345,8 +345,8 @@ def create_user_backend(request, user_profile, email=REQ(), password=REQ(), # invited first.) realm = user_profile.realm if not email_allowed_for_realm(email, user_profile.realm): - return json_error(_("Email '%(email)s' does not belong to domain '%(domain)s'") % - {'email': email, 'domain': realm.domain}) + return json_error(_("Email '%(email)s' not allowed for realm '%(realm)s'") % + {'email': email, 'realm': realm.string_id}) try: get_user_profile_by_email(email)