mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
disable password reset if no mail is set
This commit is contained in:
@@ -16,7 +16,7 @@ class AllAuthCustomAdapter(DefaultAccountAdapter):
|
||||
|
||||
# disable password reset for now
|
||||
def send_mail(self, template_prefix, email, context):
|
||||
if settings.EMAIL_HOST == '':
|
||||
if settings.EMAIL_HOST != '':
|
||||
super(AllAuthCustomAdapter, self).send_mail(template_prefix, email, context)
|
||||
else:
|
||||
pass
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 %}
|
||||
@@ -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>
|
||||
|
||||
@@ -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 %}
|
||||
Reference in New Issue
Block a user