user library update

This commit is contained in:
Dirk Alders 2024-10-26 20:16:16 +02:00
parent a6277fc1e2
commit 7d1f4023e3
3 changed files with 53 additions and 3 deletions

View File

@ -13,7 +13,36 @@ STARTPAGE = "startpage"
# Users library # Users library
# #
# This enables or disables the self registration # 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 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 = "<smtp_host>"
# The port used for the smtp connection
# EMAIL_PORT = <port_number>
# The username for smtp authentication
# EMAIL_HOST_USER = "<smtp_user>"
# The password for smtp authentication
# EMAIL_HOST_PASSWORD = "<smtp_password>"
# The sender of piki emails
# EMAIL_FROM = "piki@<host>"
# 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 # 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! # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key!
SECRET_KEY = None SECRET_KEY = None
# Define the administrators (for mail delivery)
ADMINS = [("Piki", {EMAIL_FROM}), ]
# This defines the listener hostnames for your django server # 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! # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
# ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ] # ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ]

View File

@ -141,6 +141,8 @@ PAGES_ROOT = os.path.join(BASE_DIR, 'data', 'pages')
WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh') WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh')
LOGIN_URL = 'users-login'
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
@ -162,6 +164,18 @@ USER_CONFIG_DEFAULTS = {
'DEFAULT_THEME': 'clear-blue', 'DEFAULT_THEME': 'clear-blue',
'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ], 'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ],
'CSRF_TRUSTED_ORIGINS': [], '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 # Set configuration parameters
@ -170,10 +184,13 @@ thismodule = sys.modules[__name__]
for property_name in USER_CONFIG_DEFAULTS: for property_name in USER_CONFIG_DEFAULTS:
try: try:
value = getattr(config, property_name) value = getattr(config, property_name)
setattr(thismodule, property_name, value)
except AttributeError: except AttributeError:
if not property_name.startswith('EMAIL_') or property_name == 'EMAIL_FROM':
value = USER_CONFIG_DEFAULTS[property_name] value = USER_CONFIG_DEFAULTS[property_name]
setattr(thismodule, property_name, value) setattr(thismodule, property_name, value)
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
# #
if SECRET_KEY is None: if SECRET_KEY is None:

2
users

@ -1 +1 @@
Subproject commit c9532aaf37cc785583d7ffc89d1d2f738985171d Subproject commit d18f439cc275fcde71119c4c4af85d7fe978b02d