|
47 | 47 | ] |
48 | 48 |
|
49 | 49 | MIDDLEWARE_CLASSES = [ |
| 50 | + 'django.middleware.security.SecurityMiddleware', |
50 | 51 | 'django.contrib.sessions.middleware.SessionMiddleware', |
51 | 52 | 'django.middleware.locale.LocaleMiddleware', |
52 | 53 | 'django.middleware.common.CommonMiddleware', |
|
55 | 56 | 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', |
56 | 57 | 'django.contrib.messages.middleware.MessageMiddleware', |
57 | 58 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
58 | | - 'django.middleware.security.SecurityMiddleware', |
59 | 59 | 'django.contrib.sites.middleware.CurrentSiteMiddleware' |
60 | 60 | ] |
61 | 61 |
|
|
71 | 71 | 'django.template.context_processors.debug', |
72 | 72 | 'django.template.context_processors.request', |
73 | 73 | 'django.contrib.auth.context_processors.auth', |
74 | | - 'django.contrib.messages.context_processors.messages' |
| 74 | + 'django.contrib.messages.context_processors.messages', |
| 75 | + 'django_settings_export.settings_export', |
75 | 76 | ], |
76 | 77 | }, |
77 | 78 | }, |
|
90 | 91 | } |
91 | 92 | } |
92 | 93 |
|
| 94 | +ACCOUNT_SIGNUP = True |
| 95 | + |
| 96 | +ACCOUNT_UPDATE_PROFILE = True |
| 97 | +ACCOUNT_UPDATE_EMAIL = True |
| 98 | +ACCOUNT_UPDATE_PASSWORD = True |
| 99 | + |
93 | 100 | ACCOUNT_SIGNUP_FORM_CLASS = 'apps.accounts.forms.SignupForm' |
94 | 101 | ACCOUNT_USER_DISPLAY = 'apps.accounts.utils.get_full_name' |
95 | 102 | ACCOUNT_EMAIL_REQUIRED = True |
|
100 | 107 | ACCOUNT_USERNAME_MIN_LENGTH = 4 |
101 | 108 | ACCOUNT_PASSWORD_MIN_LENGTH = 4 |
102 | 109 |
|
| 110 | +SOCIALACCOUNT = False |
| 111 | + |
103 | 112 | LANGUAGE_CODE = 'en-us' |
104 | 113 |
|
105 | 114 | TIME_ZONE = 'Europe/Berlin' |
|
156 | 165 | 'UNICODE_JSON': False |
157 | 166 | } |
158 | 167 |
|
| 168 | +SETTINGS_EXPORT = [ |
| 169 | + 'LOGIN_URL', |
| 170 | + 'LOGOUT_URL', |
| 171 | + 'ACCOUNT_SIGNUP', |
| 172 | + 'ACCOUNT_UPDATE_PROFILE', |
| 173 | + 'ACCOUNT_UPDATE_EMAIL', |
| 174 | + 'ACCOUNT_UPDATE_PASSWORD', |
| 175 | + 'SOCIALACCOUNT', |
| 176 | +] |
| 177 | + |
159 | 178 | EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' |
160 | 179 | |
161 | 180 |
|
|
178 | 197 | except ImportError: |
179 | 198 | pass |
180 | 199 |
|
181 | | -try: |
182 | | - ADDITIONAL_APPS |
183 | | -except NameError: |
184 | | - pass |
185 | | -else: |
186 | | - INSTALLED_APPS = INSTALLED_APPS + ADDITIONAL_APPS |
| 200 | +# check if any socialaccount providers are enabled |
| 201 | +if any([app.startswith('allauth.socialaccount.providers') for app in INSTALLED_APPS]): |
| 202 | + SOCIALACCOUNT = True |
| 203 | + |
| 204 | +# add Shibboleth configuration if local.SHIBBOLETH_ATTRIBUTE_LIST is set |
| 205 | +if 'shibboleth' in INSTALLED_APPS: |
| 206 | + AUTHENTICATION_BACKENDS = ( |
| 207 | + 'shibboleth.backends.ShibbolethRemoteUserBackend', |
| 208 | + 'django.contrib.auth.backends.ModelBackend', |
| 209 | + ) |
| 210 | + |
| 211 | + MIDDLEWARE_CLASSES.insert( |
| 212 | + MIDDLEWARE_CLASSES.index('django.contrib.auth.middleware.AuthenticationMiddleware') + 1, |
| 213 | + 'shibboleth.middleware.ShibbolethRemoteUserMiddleware' |
| 214 | + ) |
| 215 | + |
| 216 | + LOGIN_URL = '/Shibboleth.sso/Login' |
| 217 | + LOGOUT_URL = '/Shibboleth.sso/Logout' |
| 218 | + |
| 219 | + ACCOUNT_UPDATE_PROFILE = False |
| 220 | + ACCOUNT_UPDATE_EMAIL = False |
| 221 | + ACCOUNT_UPDATE_PASSWORD = False |
187 | 222 |
|
| 223 | +# add static and templates from local.THEME_DIR to STATICFILES_DIRS and TEMPLATES |
188 | 224 | try: |
189 | 225 | THEME_DIR |
190 | 226 | except NameError: |
|
195 | 231 | ] |
196 | 232 | TEMPLATES[0]['DIRS'].append(os.path.join(THEME_DIR, 'templates/')) |
197 | 233 |
|
| 234 | +# prepend the local.BASE_URL to the different URL settings |
198 | 235 | try: |
199 | 236 | BASE_URL |
200 | 237 | except NameError: |
|
0 commit comments