diff --git a/dLitepay/settings.py b/dLitepay/settings.py index 73c75b7..3d42183 100644 --- a/dLitepay/settings.py +++ b/dLitepay/settings.py @@ -26,7 +26,7 @@ SECRET_KEY = 'django-insecure-z#_ppfgs06)e4v18t!970-&-&jkxht!tw&ms#u5n_m-fbxulwa # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ['10.0.70.5'] +ALLOWED_HOSTS = ['10.0.70.5', '127.0.0.1'] # User substitution # https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#auth-custom-user @@ -43,6 +43,13 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'django_bcrypt', + 'django_otp', + 'django_otp.plugins.otp_static', + 'django_otp.plugins.otp_totp', + 'django_otp.plugins.otp_email', # <- if you want email capability. + 'two_factor', + 'two_factor.plugins.phonenumber', # <- if you want phone number capability. + 'two_factor.plugins.email', # <- if you want email capability. # 'base.apps.BaseConfig', 'users.apps.UsersConfig', @@ -54,6 +61,7 @@ MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django_otp.middleware.OTPMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] @@ -143,23 +151,44 @@ STATICFILES_DIRS = [ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + }, + }, + 'loggers': { + 'two_factor': { + 'handlers': ['console'], + 'level': 'INFO', + } + } +} + # Messages customize MESSAGE_TAGS = { - messages.DEBUG: "alert-info", - messages.INFO: "alert-info", - messages.SUCCESS: "alert-success", - messages.WARNING: "alert-warning", - messages.ERROR: "alert-danger", + messages.DEBUG: "text-info", + messages.INFO: "text-info", + messages.SUCCESS: "text-success", + messages.WARNING: "text-warning", + messages.ERROR: "text-danger", } - BCRYPT_ROUNDS = 11 PASSWORD_RESET_TIMEOUT = 3600 # +#LOGIN_URL = 'two_factor:login' +#OTP_LOGIN_URL = 'account:login' SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_COOKIE_SECURE = False #to be switched to true when in prod CSRF_COOKIE_SECURE = False #to be switched to true when in prod SECURE_SSL_REDIRECT = False #to be switched to true when in prod SESSION_COOKIE_AGE = 3600 -SERVER_EMAIL = 'info@litepay.ch' \ No newline at end of file +TWO_FACTOR_REMEMBER_COOKIE_AGE = 3600 +SERVER_EMAIL = 'info@litepay.ch' +DEFAULT_FROM_EMAIL = 'info@litepay.ch' \ No newline at end of file diff --git a/dLitepay/urls.py b/dLitepay/urls.py index 9738c13..5c97f9d 100644 --- a/dLitepay/urls.py +++ b/dLitepay/urls.py @@ -16,9 +16,15 @@ Including another URLconf """ from django.contrib import admin from django.urls import path, include +from two_factor.urls import urlpatterns as tf_urls +urlpatterns = [ + #path('', include(tf_urls)), + path('', include('base.urls')) +] - +''' urlpatterns = [ path('admin/', admin.site.urls), - path('', include('base.urls')) + ] +''' \ No newline at end of file