diff --git a/CHANGELOG.md b/CHANGELOG.md index 88a3ebc7..02293a92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ All notable changes to this project will be documented in this file. ## Bug Fixes - Fix javascript code to construct correct URLs when running from a subdirectory (#273) - +- Don't show the "Sign Up" link in the login page if registration is closed (#280) ## 1.8.0 - 2019-07-08 diff --git a/hc/accounts/tests/test_login.py b/hc/accounts/tests/test_login.py index 73c53705..cba61608 100644 --- a/hc/accounts/tests/test_login.py +++ b/hc/accounts/tests/test_login.py @@ -105,3 +105,8 @@ class LoginTestCase(BaseTestCase): r = self.client.post("/accounts/login/", form) self.assertContains(r, "Incorrect email or password") + + @override_settings(REGISTRATION_OPEN=False) + def test_it_obeys_registration_open(self): + r = self.client.get("/accounts/login/") + self.assertNotContains(r, "Create Your Account") diff --git a/hc/accounts/views.py b/hc/accounts/views.py index 39ac353a..5c4e9a9b 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -132,6 +132,7 @@ def login(request): "form": form, "magic_form": magic_form, "bad_link": bad_link, + "registration_open": settings.REGISTRATION_OPEN, } return render(request, "accounts/login.html", ctx) diff --git a/templates/accounts/login.html b/templates/accounts/login.html index 9d70980c..8c7637c1 100644 --- a/templates/accounts/login.html +++ b/templates/accounts/login.html @@ -89,17 +89,22 @@ + {% if registration_open %}