Set default password policies in base settings

This commit is contained in:
Christopher C. Wells 2021-09-16 19:14:48 -07:00
parent 8ea68eed54
commit 45cb43958d
8 changed files with 46 additions and 6 deletions

View File

@ -234,16 +234,35 @@ if AWS_STORAGE_BUCKET_NAME:
# Security
# https://docs.djangoproject.com/en/3.2/topics/http/sessions/#settings
# https://docs.djangoproject.com/en/3.2/ref/csrf/#settings
# See https://docs.djangoproject.com/en/3.2/ref/settings/#secure-proxy-ssl-header for why and when to set this
# https://docs.djangoproject.com/en/3.2/ref/settings/#secure-proxy-ssl-header
if os.environ.get('SECURE_PROXY_SSL_HEADER'):
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# https://docs.djangoproject.com/en/3.2/topics/http/sessions/#settings
SESSION_COOKIE_SECURE = True
# https://docs.djangoproject.com/en/3.2/ref/csrf/#settings
CSRF_COOKIE_SECURE = True
# https://docs.djangoproject.com/en/3.2/topics/auth/passwords/
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
'OPTIONS': {
'min_length': 8,
}
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Django Rest Framework
# https://www.django-rest-framework.org/

View File

@ -65,6 +65,15 @@
z-index: 1030;
}
// Tweak padding on form field help blocks.
.help-block {
ul {
padding-left: 1rem;
padding-bottom: 0;
margin-bottom: 0;
}
}
@include media-breakpoint-up(md) {
// Restore regular inline button on larger screens.
.submit-primary {

View File

@ -75,8 +75,8 @@ class FormsTestCase(TestCase):
'first_name': 'User',
'last_name': 'Name',
'email': 'user@user.user',
'password1': 'password',
'password2': 'password'
'password1': 'd47o8dD&#hu3ulu3',
'password2': 'd47o8dD&#hu3ulu3'
}
page = self.c.post('/users/add/', params)

View File

@ -10526,6 +10526,12 @@ h3 {
z-index: 1030;
}
.help-block ul {
padding-left: 1rem;
padding-bottom: 0;
margin-bottom: 0;
}
@media (min-width: 768px) {
.submit-primary {
display: inline-block;

Binary file not shown.

View File

@ -10526,6 +10526,12 @@ h3 {
z-index: 1030;
}
.help-block ul {
padding-left: 1rem;
padding-bottom: 0;
margin-bottom: 0;
}
@media (min-width: 768px) {
.submit-primary {
display: inline-block;

File diff suppressed because one or more lines are too long