Commit 5b010af3 authored by Michal Čihař's avatar Michal Čihař

Hide registration links if it is not enabled (issue #131)

parent f94a9e93
......@@ -45,7 +45,9 @@
<li><a href="{% url 'profile' %}">{% blocktrans with user.get_full_name as name %}Logged in as {{ name }}{% endblocktrans %}</a></li>
<li><a href="{% url 'auth_logout' %}">{% trans "Logout" %}</a></li>
{% else %}
{% if registration_open %}
<li><a href="{% url 'weblate_register' %}">{% trans "Register" %}</a></li>
{% endif %}
<li><a href="{% url 'auth_login' %}?next={{ current_url }}">{% trans "Login" %}</a></li>
{% endif %}
</ul>
......
......@@ -31,10 +31,12 @@
<input type="hidden" name="next" value="{{ next }}" />
</form>
{% if registration_open %}
<p>
{% url 'registration.views.register' as register_url %}
{% blocktrans %}Do not have an account yet? You can <a href="{{ register_url }}">register</a>.{% endblocktrans %}
</p>
{% endif %}
<p>
{% url 'auth_password_reset' as reset_url %}
......
......@@ -194,6 +194,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'weblate.trans.context_processors.date',
'weblate.trans.context_processors.url',
'weblate.trans.context_processors.mt',
'weblate.trans.context_processors.registration',
)
if DEBUG:
......
......@@ -45,3 +45,8 @@ def mt(request):
'apertium_api_key': settings.MT_APERTIUM_KEY,
'microsoft_api_key': settings.MT_MICROSOFT_KEY,
}
def registration(request):
return {
'registration_open': getattr(settings, 'REGISTRATION_OPEN', True),
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment