add new vars of 2factor and send emails
This commit is contained in:
parent
98ffdd0e3f
commit
ddd25d0655
|
@ -57,12 +57,13 @@ class NotifyActivateUserByEmail:
|
||||||
html_email = loader.render_to_string(self.html_email_template_name, context)
|
html_email = loader.render_to_string(self.html_email_template_name, context)
|
||||||
email_message.attach_alternative(html_email, 'text/html')
|
email_message.attach_alternative(html_email, 'text/html')
|
||||||
try:
|
try:
|
||||||
if settings.DEVELOPMENT:
|
if settings.ENABLE_EMAIL:
|
||||||
logger.warning(to_email)
|
email_message.send()
|
||||||
logger.warning(body)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
email_message.send()
|
logger.warning(to_email)
|
||||||
|
logger.warning(body)
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -56,7 +56,7 @@ class LoginView(auth_views.LoginView):
|
||||||
# )
|
# )
|
||||||
# cache.set("KEY_DIDS", encryption_key, None)
|
# cache.set("KEY_DIDS", encryption_key, None)
|
||||||
cache.set("KEY_DIDS", sensitive_data_encryption_key, None)
|
cache.set("KEY_DIDS", sensitive_data_encryption_key, None)
|
||||||
if not settings.DEVELOPMENT:
|
if settings.AUTH2FACTOR:
|
||||||
self.request.session["2fauth"] = str(uuid.uuid4())
|
self.request.session["2fauth"] = str(uuid.uuid4())
|
||||||
return redirect(reverse_lazy('idhub:confirm_send_2f'))
|
return redirect(reverse_lazy('idhub:confirm_send_2f'))
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ SECRET_KEY = config('SECRET_KEY')
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = config('DEBUG', default=False, cast=bool)
|
DEBUG = config('DEBUG', default=False, cast=bool)
|
||||||
DEVELOPMENT = config('DEVELOPMENT', default=False, cast=bool)
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='', cast=Csv())
|
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='', cast=Csv())
|
||||||
CSRF_TRUSTED_ORIGINS = config('CSRF_TRUSTED_ORIGINS', default='', cast=Csv())
|
CSRF_TRUSTED_ORIGINS = config('CSRF_TRUSTED_ORIGINS', default='', cast=Csv())
|
||||||
|
@ -226,3 +225,7 @@ LOGGING = {
|
||||||
ORGANIZATION = config('ORGANIZATION', 'Pangea')
|
ORGANIZATION = config('ORGANIZATION', 'Pangea')
|
||||||
SYNC_ORG_DEV = config('SYNC_ORG_DEV', 'y')
|
SYNC_ORG_DEV = config('SYNC_ORG_DEV', 'y')
|
||||||
ORG_FILE = config('ORG_FILE', 'examples/organizations.csv')
|
ORG_FILE = config('ORG_FILE', 'examples/organizations.csv')
|
||||||
|
ENABLE_EMAIL = config('ENABLE_EMAIL', default=True, cast=bool)
|
||||||
|
CREATE_TEST_USERS = config('CREATE_TEST_USERS', default=False, cast=bool)
|
||||||
|
AUTH2FACTOR = config('AUTH2FACTOR', default=True, cast=bool)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue