2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-14 19:15:41 +00:00

Merge branch 'master' of https://github.com/inventree/InvenTree into onboarding-group

This commit is contained in:
Matthias
2021-10-14 22:18:42 +02:00

View File

@ -9,6 +9,7 @@ import logging
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.contrib.auth.models import User, Group
from django.conf import settings
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field
@ -260,7 +261,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
@ -283,7 +284,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