add settings to hide the password reset link on login page

This commit is contained in:
Benjamin Dauvergne 2013-12-11 03:27:44 +01:00
parent 6a69f74395
commit 6daa256e51
3 changed files with 6 additions and 2 deletions

View File

@ -88,6 +88,7 @@ __settings = dict(
definition='Can user self delete their account and all their data'),
A2_HOMEPAGE_URL = Setting(default=None, definition='IdP has no homepage, '
'redirect to this one.'),
A2_CAN_RESET_PASSWORD = Setting(default=True, definition='Allow online reset of passwords'),
)
for key, value in __settings.iteritems():

View File

@ -11,8 +11,9 @@
</div>
<div class="login-actions">
<p>→ {% trans "Forgot password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it!" %}</a></p>
<p>→ {% trans "Not a member?" %} <a href="{% url 'registration_register' %}">{% trans "Register!" %}</a></p>
{% if can_reset_password %}
<p>→ {% trans "Forgot password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it!" %}</a></p>
{% endif %}
{% if registration_authorized %}
<p>→ {% trans "Not a member?" %} <a href="{% url 'registration_register' %}">{% trans "Register!" %}</a></p>
{% endif %}

View File

@ -20,6 +20,7 @@ from authentic2.auth2_auth import NONCE_FIELD_NAME
from authentic2.idp import get_backends
from .. import app_settings
def add_arg(url, key, value = None):
'''Add a parameter to an URL'''
key = urllib.quote(key)
@ -85,6 +86,7 @@ def login(request, template_name='auth/login.html',
context = { 'cancel': nonce is not None,
'submit_name': 'submit-%s' % d['backend'].id(),
redirect_field_name: redirect_to,
'can_reset_password': app_settings.A2_CAN_RESET_PASSWORD,
'registration_authorized': app_settings.A2_REGISTRATION_AUTHORIZED,
'form': d['form'] }
if hasattr(d['backend'], 'get_context'):