Don't show the "Sign Up" link in the login page if registration is closed. Fixes #280

This commit is contained in:
Pēteris Caune 2019-08-26 10:55:41 +03:00
parent 9474006d83
commit dfee69584b
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
4 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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")

View File

@ -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)

View File

@ -89,17 +89,22 @@
</div>
</div>
{% if registration_open %}
<div class="row">
<div id="login-signup-cta" class="col-sm-12 text-center">
Don't have an account?
<a href="#" data-toggle="modal" data-target="#signup-modal">Sign Up</a>
</div>
</div>
{% endif %}
</div>
</div>
{% if registration_open %}
{% include "front/signup_modal.html" %}
{% endif %}
{% endblock %}
{% block scripts %}