diff --git a/config_example/config.py b/config_example/config.py index ad1d7fc..c274be8 100644 --- a/config_example/config.py +++ b/config_example/config.py @@ -13,7 +13,36 @@ STARTPAGE = "startpage" # Users library # # This enables or disables the self registration +# If you enable self registration it is recommended to configure "Django mail / smtp settings" USERS_SELF_REGISTRATION = False +# This enables or disables the mail validation after self registration +USERS_MAIL_VALIDATION = True +# This enables or disables the account activation by an admin after self registration +USERS_ADMIN_ACTIVATION = True + +# +# Django mail / smtp settings +# +# The hostname of the smtp server +# EMAIL_HOST = "" +# The port used for the smtp connection +# EMAIL_PORT = +# The username for smtp authentication +# EMAIL_HOST_USER = "" +# The password for smtp authentication +# EMAIL_HOST_PASSWORD = "" +# The sender of piki emails +# EMAIL_FROM = "piki@" +# Set to True, if TLS shall be used +# EMAIL_USE_TLS = False +# Set to True, if SSL shall be used +# EMAIL_USE_SSL = True +# The smtp timeout +# EMAIL_TIMEOUT = +# Define a ssl keyfile +# EMAIL_SSL_KEYFILE = +# Define an ssl certificate +# EMAIL_SSL_CERTFILE = # # Themes library @@ -32,6 +61,10 @@ DEBUG = False # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key! SECRET_KEY = None +# Define the administrators (for mail delivery) +ADMINS = [("Piki", {EMAIL_FROM}), ] + + # This defines the listener hostnames for your django server # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing! # ALLOWED_HOSTS = ['', ] diff --git a/piki/settings.py b/piki/settings.py index 2f2c39c..8170ca9 100644 --- a/piki/settings.py +++ b/piki/settings.py @@ -141,6 +141,8 @@ PAGES_ROOT = os.path.join(BASE_DIR, 'data', 'pages') WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh') +LOGIN_URL = 'users-login' + # Default primary key field type # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field @@ -162,6 +164,18 @@ USER_CONFIG_DEFAULTS = { 'DEFAULT_THEME': 'clear-blue', 'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ], 'CSRF_TRUSTED_ORIGINS': [], + 'ADMINS': [], + # + 'EMAIL_HOST': None, + 'EMAIL_PORT': None, + 'EMAIL_HOST_USER': None, + 'EMAIL_FROM': "piki", + 'EMAIL_HOST_PASSWORD': None, + 'EMAIL_USE_TLS': None, + 'EMAIL_USE_SSL': None, + 'EMAIL_TIMEOUT': None, + 'EMAIL_SSL_KEYFILE': None, + 'EMAIL_SSL_CERTFILE': None, } # Set configuration parameters @@ -170,9 +184,12 @@ thismodule = sys.modules[__name__] for property_name in USER_CONFIG_DEFAULTS: try: value = getattr(config, property_name) + setattr(thismodule, property_name, value) except AttributeError: - value = USER_CONFIG_DEFAULTS[property_name] - setattr(thismodule, property_name, value) + if not property_name.startswith('EMAIL_') or property_name == 'EMAIL_FROM': + value = USER_CONFIG_DEFAULTS[property_name] + setattr(thismodule, property_name, value) + # SECURITY WARNING: keep the secret key used in production secret! # diff --git a/users b/users index c9532aa..d18f439 160000 --- a/users +++ b/users @@ -1 +1 @@ -Subproject commit c9532aaf37cc785583d7ffc89d1d2f738985171d +Subproject commit d18f439cc275fcde71119c4c4af85d7fe978b02d