Skip to content

Commit d8a132d

Browse files
author
Guillim
committed
we add a verification that the email is already configured to avoid an error while creating a user and sending a confirmation email
1 parent 04ee45a commit d8a132d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{% extends "base_auth.html" %}
2+
3+
{% block content_auth %}
4+
<div class="card-content">
5+
<p>
6+
The webmaster hasn't set up any emails yet, so we can't send you any link confirmation
7+
</p>
8+
<p>
9+
Please contact the admin to learn more
10+
</p>
11+
</div>
12+
{% endblock %}

app/authentification/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def post(self, request, *args, **kwargs):
2626
if not bool(settings.ALLOW_SIGNUP):
2727
return redirect('signup')
2828

29+
if not hasattr(settings, "EMAIL_BACKEND") or not hasattr(settings, "EMAIL_HOST"):
30+
return render(request, 'email_not_set.html')
31+
2932
if form.is_valid():
3033
user = form.save(commit=False)
3134
user.is_active = False

0 commit comments

Comments
 (0)