mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
Show new users an error page when they try to sign up for a deactivated realm.
(imported from commit 1696a6a5d26ec92b881cd3fda43e6b262e2fbfa5)
This commit is contained in:
14
templates/zerver/deactivated.html
Normal file
14
templates/zerver/deactivated.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{% extends "zerver/portico.html" %}
|
||||||
|
|
||||||
|
{% block portico_content %}
|
||||||
|
|
||||||
|
<h3>Deactivated organization</h3>
|
||||||
|
|
||||||
|
<p>Hi there! Thank you for your interest in Zulip.</p>
|
||||||
|
|
||||||
|
<p>The organization you are trying to join, {{ deactivated_domain_name }}, has
|
||||||
|
been deactivated. Please
|
||||||
|
contact <a href="mailto:support@zulip.com">support@zulip.com</a> to reactivate
|
||||||
|
this group.</p>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -811,6 +811,21 @@ class LoginTest(AuthedTestCase):
|
|||||||
user_profile = get_user_profile_by_email('test@zulip.com')
|
user_profile = get_user_profile_by_email('test@zulip.com')
|
||||||
self.assertEqual(self.client.session['_auth_user_id'], user_profile.id)
|
self.assertEqual(self.client.session['_auth_user_id'], user_profile.id)
|
||||||
|
|
||||||
|
def test_register_deactivated(self):
|
||||||
|
"""
|
||||||
|
If you try to register for a deactivated realm, you get a clear error
|
||||||
|
page.
|
||||||
|
"""
|
||||||
|
realm = Realm.objects.get(domain="zulip.com")
|
||||||
|
realm.deactivated = True
|
||||||
|
realm.save(update_fields=["deactivated"])
|
||||||
|
|
||||||
|
result = self.register("test", "test")
|
||||||
|
self.assertIn("has been deactivated", result.content.replace("\n", " "))
|
||||||
|
|
||||||
|
with self.assertRaises(UserProfile.DoesNotExist):
|
||||||
|
get_user_profile_by_email('test@zulip.com')
|
||||||
|
|
||||||
def test_logout(self):
|
def test_logout(self):
|
||||||
self.login("hamlet@zulip.com")
|
self.login("hamlet@zulip.com")
|
||||||
self.client.post('/accounts/logout/')
|
self.client.post('/accounts/logout/')
|
||||||
|
|||||||
@@ -241,6 +241,13 @@ def accounts_register(request):
|
|||||||
else:
|
else:
|
||||||
domain = resolve_email_to_domain(email)
|
domain = resolve_email_to_domain(email)
|
||||||
|
|
||||||
|
realm = get_realm(domain)
|
||||||
|
if realm and realm.deactivated:
|
||||||
|
# The user is trying to register for a deactivated realm. Advise them to
|
||||||
|
# contact support.
|
||||||
|
return render_to_response("zerver/deactivated.html",
|
||||||
|
{"deactivated_domain_name": realm.name})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if mit_beta_user:
|
if mit_beta_user:
|
||||||
# MIT users already exist, but are supposed to be inactive.
|
# MIT users already exist, but are supposed to be inactive.
|
||||||
|
|||||||
Reference in New Issue
Block a user