Browse Source

user library update

master
Dirk Alders 1 month ago
parent
commit
7d1f4023e3
3 changed files with 53 additions and 3 deletions
  1. 33
    0
      config_example/config.py
  2. 19
    2
      piki/settings.py
  3. 1
    1
      users

+ 33
- 0
config_example/config.py View File

13
 # Users library
13
 # Users library
14
 #
14
 #
15
 # This enables or disables the self registration
15
 # This enables or disables the self registration
16
+# If you enable self registration it is recommended to configure "Django mail / smtp settings"
16
 USERS_SELF_REGISTRATION = False
17
 USERS_SELF_REGISTRATION = False
18
+# This enables or disables the mail validation after self registration
19
+USERS_MAIL_VALIDATION = True
20
+# This enables or disables the account activation by an admin after self registration
21
+USERS_ADMIN_ACTIVATION = True
22
+
23
+#
24
+# Django mail / smtp settings
25
+#
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 =
17
 
46
 
18
 #
47
 #
19
 # Themes library
48
 # Themes library
32
 # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key!
61
 # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key!
33
 SECRET_KEY = None
62
 SECRET_KEY = None
34
 
63
 
64
+# Define the administrators (for mail delivery)
65
+ADMINS = [("Piki", {EMAIL_FROM}), ]
66
+
67
+
35
 # This defines the listener hostnames for your django server
68
 # This defines the listener hostnames for your django server
36
 # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
69
 # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
37
 # ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ]
70
 # ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ]

+ 19
- 2
piki/settings.py View File

141
 
141
 
142
 WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh')
142
 WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh')
143
 
143
 
144
+LOGIN_URL = 'users-login'
145
+
144
 # Default primary key field type
146
 # Default primary key field type
145
 # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
147
 # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
146
 
148
 
162
     'DEFAULT_THEME': 'clear-blue',
164
     'DEFAULT_THEME': 'clear-blue',
163
     'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ],
165
     'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ],
164
     'CSRF_TRUSTED_ORIGINS': [],
166
     'CSRF_TRUSTED_ORIGINS': [],
167
+    'ADMINS': [],
168
+    #
169
+    'EMAIL_HOST': None,
170
+    'EMAIL_PORT': None,
171
+    'EMAIL_HOST_USER': None,
172
+    'EMAIL_FROM': "piki",
173
+    'EMAIL_HOST_PASSWORD': None,
174
+    'EMAIL_USE_TLS': None,
175
+    'EMAIL_USE_SSL': None,
176
+    'EMAIL_TIMEOUT': None,
177
+    'EMAIL_SSL_KEYFILE': None,
178
+    'EMAIL_SSL_CERTFILE': None,
165
 }
179
 }
166
 
180
 
167
 # Set configuration parameters
181
 # Set configuration parameters
170
 for property_name in USER_CONFIG_DEFAULTS:
184
 for property_name in USER_CONFIG_DEFAULTS:
171
     try:
185
     try:
172
         value = getattr(config, property_name)
186
         value = getattr(config, property_name)
187
+        setattr(thismodule, property_name, value)
173
     except AttributeError:
188
     except AttributeError:
174
-        value = USER_CONFIG_DEFAULTS[property_name]
175
-    setattr(thismodule, property_name, value)
189
+        if not property_name.startswith('EMAIL_') or property_name == 'EMAIL_FROM':
190
+            value = USER_CONFIG_DEFAULTS[property_name]
191
+            setattr(thismodule, property_name, value)
192
+
176
 
193
 
177
 # SECURITY WARNING: keep the secret key used in production secret!
194
 # SECURITY WARNING: keep the secret key used in production secret!
178
 #
195
 #

+ 1
- 1
users

1
-Subproject commit c9532aaf37cc785583d7ffc89d1d2f738985171d
1
+Subproject commit d18f439cc275fcde71119c4c4af85d7fe978b02d

Loading…
Cancel
Save