Skip to content
Snippets Groups Projects
Commit 6553a020 authored by Calum Mackervoy's avatar Calum Mackervoy
Browse files

if registration closed dont display form

parent 1973d2b4
No related branches found
Tags v0.2.27
1 merge request!46Registration form hidden if REGISTRATION_OPEN is False
Pipeline #1955 passed
......@@ -59,9 +59,11 @@
</form>
</div>
<div class="flex-column">
<p class="other-login-title text-center">{% trans "Doesn't have an account yet?" %}</p>
<a class="sib-link sib-register-link" href="{% url 'django_registration_register' %}?next={{next|urlencode}}">{% trans "Register now!" %}</a>
</div>
{% if registration_open %}
<div class="flex-column">
<p class="other-login-title text-center">{% trans "Doesn't have an account yet?" %}</p>
<a class="sib-link sib-register-link" href="{% url 'django_registration_register' %}?next={{next|urlencode}}">{% trans "Register now!" %}</a>
</div>
{% endif %}
</div>
{% endblock %}
......@@ -92,6 +92,15 @@ class LDPAccountLoginView(LoginView):
"""
Extension of django.contrib.auth.views.LoginView for managing user's default_redirect_uri
"""
def get_context_data(self, **kwargs):
from django.conf import settings
context = super().get_context_data(**kwargs)
context.update({
'registration_open': getattr(settings, 'REGISTRATION_OPEN', True),
})
return context
# Save login url as preferred redirect
def post(self, request, *args, **kwargs):
return_value = super(LDPAccountLoginView, self).post(request, *args, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment