disable password reset if no mail is set

This commit is contained in:
vabene1111
2021-05-28 18:41:30 +02:00
parent 71fdfe6acb
commit 46a8a9f60d
5 changed files with 26 additions and 17 deletions

View File

@@ -27,7 +27,11 @@
<button class="btn btn-primary" type="submit">{% trans "Sign In" %}</button>
<a class="btn btn-success" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
<a class="btn btn-secondary" href="{% url 'account_reset_password' %}">{% trans "Reset Password" %}</a>
{% if settings.EMAIL_HOST != '' %}
<a class="btn btn-secondary"
href="{% url 'account_reset_password' %}">{% trans "Reset Password" %}</a>
{% endif %}
</form>
</div>
</div>

View File

@@ -4,23 +4,29 @@
{% load i18n %}
{% load account %}
{% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block title %}{% trans 'Password Reset' %}{% endblock %}
{% block content %}
<h3>{% trans "Password Reset" %}</h3>
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
{% if settings.EMAIL_HOST != '' %}
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
<form method="POST" action="{% url 'account_reset_password' %}" class="password_reset">
{% csrf_token %}
{{ form | crispy }}
<input type="submit" class="btn btn-success" value="{% trans 'Reset My Password' %}"/>
<a class="btn btn-primary" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
<a class="btn btn-info" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
</form>
{% else %}
<p>{% trans 'Password reset is disabled on this instance.' %}</p>
{% endif %}
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
<form method="POST" action="{% url 'account_reset_password' %}" class="password_reset">
{% csrf_token %}
{{ form | crispy}}
<input type="submit" class="btn btn-primary" value="{% trans 'Reset My Password' %}" />
<a class="btn btn-primary" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
<a class="btn btn-success" href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a>
</form>
{% endblock %}

View File

@@ -4,7 +4,7 @@
{% load i18n %}
{% load account %}
{% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block title %}{% trans "Password Reset" %}{% endblock %}
{% block content %}
<h3>{% trans "Password Reset" %}</h3>

View File

@@ -2,13 +2,12 @@
{% load i18n %}
{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %}
{% block title %}{% trans "Sign Up Closed" %}{% endblock %}
{% block content %}
<h1>{% trans "Sign Up Closed" %}</h1>
<h1>{% trans "Sign Up Closed" %}</h1>
<p>{% trans "We are sorry, but the sign up is currently closed." %}</p>
<p>{% trans "We are sorry, but the sign up is currently closed." %}</p>
<a class="btn btn-primary" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
<a class="btn btn-secondary" href="{% url 'account_reset_password' %}">{% trans "Reset Password" %}</a>
{% endblock %}