password recovery integrated

This commit is contained in:
Dirk Alders 2024-11-09 07:35:22 +01:00
parent a1904d0b41
commit 08b476851e
4 changed files with 65 additions and 12 deletions

View File

@ -1,18 +1,49 @@
#######################################################################
# Configuration of your django application
#######################################################################
#
# Users library
#
# This enables or disables the self registration
USERS_SELF_REGISTRATION = False
#
# Themes library
#
# This defines the default theme, if no theme is set in the django parameters
DEFAULT_THEME = 'clear-green'
#
# 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
# The timeout for password recovery and mail validation tokens send via email
PASSWORD_RESET_TIMEOUT = 60 * 60 * 3 # 3 hours
#
# 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 =
#
# Django
#
@ -24,6 +55,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 = [("PaTT", 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 = ['<YOUR_SERVER_HOSTNAME>', ]

View File

@ -7,7 +7,7 @@ For more information on this file, see
https://docs.djangoproject.com/en/5.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
https://docs.djangoproject.com/en/5.1/ref/settings/
"""
from pathlib import Path
@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
# Application definition
@ -41,6 +41,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#
'simple_history',
]
@ -180,6 +181,20 @@ USER_CONFIG_DEFAULTS = {
'DEFAULT_THEME': 'clear-green',
'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ],
'CSRF_TRUSTED_ORIGINS': [],
'ADMINS': [],
'PASSWORD_RESET_TIMEOUT': 60*60*3,
#
'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
@ -188,9 +203,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!
#

2
themes

@ -1 +1 @@
Subproject commit 47e9f3104c5016ef9405c90ee5dfca6e638e7d82
Subproject commit b7673fa82763830009c7dc95ecf93d7e96f692f9

2
users

@ -1 +1 @@
Subproject commit 3a24ee2459d25b71cbd6cf79e486ccbf3567b928
Subproject commit 12526f44d736b360a2c92a46eabed1c455e1b4fa