From d8a132d3c04465ca2b154b1bd0a188d1c2515e21 Mon Sep 17 00:00:00 2001 From: Guillim Date: Wed, 26 Jun 2019 10:40:15 +0200 Subject: [PATCH] we add a verification that the email is already configured to avoid an error while creating a user and sending a confirmation email --- app/authentification/templates/email_not_set.html | 12 ++++++++++++ app/authentification/views.py | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 app/authentification/templates/email_not_set.html diff --git a/app/authentification/templates/email_not_set.html b/app/authentification/templates/email_not_set.html new file mode 100644 index 00000000..7a9e894e --- /dev/null +++ b/app/authentification/templates/email_not_set.html @@ -0,0 +1,12 @@ +{% extends "base_auth.html" %} + +{% block content_auth %} +
+

+ The webmaster hasn't set up any emails yet, so we can't send you any link confirmation +

+

+ Please contact the admin to learn more +

+
+{% endblock %} diff --git a/app/authentification/views.py b/app/authentification/views.py index 83abf37c..d0c55d83 100644 --- a/app/authentification/views.py +++ b/app/authentification/views.py @@ -26,6 +26,9 @@ class SignupView(TemplateView): if not bool(settings.ALLOW_SIGNUP): return redirect('signup') + if not hasattr(settings, "EMAIL_BACKEND") or not hasattr(settings, "EMAIL_HOST"): + return render(request, 'email_not_set.html') + if form.is_valid(): user = form.save(commit=False) user.is_active = False