From 3435254d2aa152a19b6078803fb3ec442daf4112 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 14 Oct 2021 16:34:59 +0200 Subject: [PATCH] fix email config check --- InvenTree/InvenTree/forms.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index 8b4b87637c..c5cd7fad58 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -8,6 +8,7 @@ from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from django import forms from django.contrib.auth.models import User +from django.conf import settings from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Field @@ -257,7 +258,7 @@ class RegistratonMixin: Mixin to check if registration should be enabled """ def is_open_for_signup(self, request): - if InvenTreeSetting.get_setting('EMAIL_HOST', None) and InvenTreeSetting.get_setting('LOGIN_ENABLE_REG', True): + if settings.EMAIL_HOST and InvenTreeSetting.get_setting('LOGIN_ENABLE_REG', True): return super().is_open_for_signup(request) return False @@ -268,7 +269,7 @@ class CustomAccountAdapter(RegistratonMixin, DefaultAccountAdapter): """ def send_mail(self, template_prefix, email, context): """only send mail if backend configured""" - if InvenTreeSetting.get_setting('EMAIL_HOST', None): + if settings.EMAIL_HOST: return super().send_mail(template_prefix, email, context) return False