Ver código fonte

password recovery integrated

master
Dirk Alders 1 mês atrás
pai
commit
08b476851e
4 arquivos alterados com 62 adições e 9 exclusões
  1. 38
    3
      config_example/config.py
  2. 22
    4
      main/settings.py
  3. 1
    1
      themes
  4. 1
    1
      users

+ 38
- 3
config_example/config.py Ver arquivo

@@ -1,17 +1,48 @@
1 1
 #######################################################################
2 2
 # Configuration of your django application
3 3
 #######################################################################
4
+#
5
+# Themes library
6
+#
7
+# This defines the default theme, if no theme is set in the django parameters
8
+DEFAULT_THEME = 'clear-green'
9
+
4 10
 #
5 11
 # Users library
6 12
 #
7 13
 # This enables or disables the self registration
14
+# If you enable self registration it is recommended to configure "Django mail / smtp settings"
8 15
 USERS_SELF_REGISTRATION = False
16
+# This enables or disables the mail validation after self registration
17
+USERS_MAIL_VALIDATION = True
18
+# This enables or disables the account activation by an admin after self registration
19
+USERS_ADMIN_ACTIVATION = True
20
+# The timeout for password recovery and mail validation tokens send via email
21
+PASSWORD_RESET_TIMEOUT = 60 * 60 * 3    # 3 hours
9 22
 
10 23
 #
11
-# Themes library
24
+# Django mail / smtp settings
12 25
 #
13
-# This defines the default theme, if no theme is set in the django parameters
14
-DEFAULT_THEME = 'clear-green'
26
+# The hostname of the smtp server
27
+# EMAIL_HOST = "<smtp_host>"
28
+# The port used for the smtp connection
29
+# EMAIL_PORT = <port_number>
30
+# The username for smtp authentication
31
+# EMAIL_HOST_USER = "<smtp_user>"
32
+# The password for smtp authentication
33
+# EMAIL_HOST_PASSWORD = "<smtp_password>"
34
+# The sender of piki emails
35
+# EMAIL_FROM = "piki@<host>"
36
+# Set to True, if TLS shall be used
37
+# EMAIL_USE_TLS = False
38
+# Set to True, if SSL shall be used
39
+# EMAIL_USE_SSL = True
40
+# The smtp timeout
41
+# EMAIL_TIMEOUT =
42
+# Define a ssl keyfile
43
+# EMAIL_SSL_KEYFILE =
44
+# Define an ssl certificate
45
+# EMAIL_SSL_CERTFILE =
15 46
 
16 47
 #
17 48
 # Django
@@ -24,6 +55,10 @@ DEBUG = False
24 55
 # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key!
25 56
 SECRET_KEY = None
26 57
 
58
+# Define the administrators (for mail delivery)
59
+ADMINS = [("PaTT", EMAIL_FROM), ]
60
+
61
+
27 62
 # This defines the listener hostnames for your django server
28 63
 # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
29 64
 # ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ]

+ 22
- 4
main/settings.py Ver arquivo

@@ -7,7 +7,7 @@ For more information on this file, see
7 7
 https://docs.djangoproject.com/en/5.1/topics/settings/
8 8
 
9 9
 For the full list of settings and their values, see
10
-https://docs.djangoproject.com/en/3.0/ref/settings/
10
+https://docs.djangoproject.com/en/5.1/ref/settings/
11 11
 """
12 12
 
13 13
 from pathlib import Path
@@ -24,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
24 24
 
25 25
 
26 26
 # Quick-start development settings - unsuitable for production
27
-# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
27
+# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
28 28
 
29 29
 
30 30
 # Application definition
@@ -41,6 +41,7 @@ INSTALLED_APPS = [
41 41
     'django.contrib.sessions',
42 42
     'django.contrib.messages',
43 43
     'django.contrib.staticfiles',
44
+    #
44 45
     'simple_history',
45 46
 ]
46 47
 
@@ -180,6 +181,20 @@ USER_CONFIG_DEFAULTS = {
180 181
     'DEFAULT_THEME': 'clear-green',
181 182
     'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ],
182 183
     'CSRF_TRUSTED_ORIGINS': [],
184
+    'ADMINS': [],
185
+    'PASSWORD_RESET_TIMEOUT': 60*60*3,
186
+    #
187
+    'EMAIL_HOST': None,
188
+    'EMAIL_PORT': None,
189
+    'EMAIL_HOST_USER': None,
190
+    'EMAIL_FROM': "piki",
191
+    'EMAIL_HOST_PASSWORD': None,
192
+    'EMAIL_USE_TLS': None,
193
+    'EMAIL_USE_SSL': None,
194
+    'EMAIL_TIMEOUT': None,
195
+    'EMAIL_SSL_KEYFILE': None,
196
+    'EMAIL_SSL_CERTFILE': None,
197
+    
183 198
 }
184 199
 
185 200
 # Set configuration parameters
@@ -188,9 +203,12 @@ thismodule = sys.modules[__name__]
188 203
 for property_name in USER_CONFIG_DEFAULTS:
189 204
     try:
190 205
         value = getattr(config, property_name)
206
+        setattr(thismodule, property_name, value)
191 207
     except AttributeError:
192
-        value = USER_CONFIG_DEFAULTS[property_name]
193
-    setattr(thismodule, property_name, value)
208
+        if not property_name.startswith('EMAIL_') or property_name == 'EMAIL_FROM':
209
+            value = USER_CONFIG_DEFAULTS[property_name]
210
+            setattr(thismodule, property_name, value)
211
+
194 212
 
195 213
 # SECURITY WARNING: keep the secret key used in production secret!
196 214
 #

+ 1
- 1
themes

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

+ 1
- 1
users

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

Carregando…
Cancelar
Salvar