Parcourir la source

user library update

master
Dirk Alders il y a 1 mois
Parent
révision
7d1f4023e3
3 fichiers modifiés avec 53 ajouts et 3 suppressions
  1. 33
    0
      config_example/config.py
  2. 19
    2
      piki/settings.py
  3. 1
    1
      users

+ 33
- 0
config_example/config.py Voir le fichier

@@ -13,7 +13,36 @@ STARTPAGE = "startpage"
13 13
 # Users library
14 14
 #
15 15
 # This enables or disables the self registration
16
+# If you enable self registration it is recommended to configure "Django mail / smtp settings"
16 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 48
 # Themes library
@@ -32,6 +61,10 @@ DEBUG = False
32 61
 # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key!
33 62
 SECRET_KEY = None
34 63
 
64
+# Define the administrators (for mail delivery)
65
+ADMINS = [("Piki", {EMAIL_FROM}), ]
66
+
67
+
35 68
 # This defines the listener hostnames for your django server
36 69
 # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
37 70
 # ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ]

+ 19
- 2
piki/settings.py Voir le fichier

@@ -141,6 +141,8 @@ PAGES_ROOT = os.path.join(BASE_DIR, 'data', 'pages')
141 141
 
142 142
 WHOOSH_PATH = os.path.join(BASE_DIR, 'data', 'whoosh')
143 143
 
144
+LOGIN_URL = 'users-login'
145
+
144 146
 # Default primary key field type
145 147
 # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
146 148
 
@@ -162,6 +164,18 @@ USER_CONFIG_DEFAULTS = {
162 164
     'DEFAULT_THEME': 'clear-blue',
163 165
     'ALLOWED_HOSTS': ['127.0.0.1', 'localhost', ],
164 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 181
 # Set configuration parameters
@@ -170,9 +184,12 @@ thismodule = sys.modules[__name__]
170 184
 for property_name in USER_CONFIG_DEFAULTS:
171 185
     try:
172 186
         value = getattr(config, property_name)
187
+        setattr(thismodule, property_name, value)
173 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 194
 # SECURITY WARNING: keep the secret key used in production secret!
178 195
 #

+ 1
- 1
users

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

Chargement…
Annuler
Enregistrer