Skip to content

Commit

Permalink
Set default password policies in base settings
Browse files Browse the repository at this point in the history
  • Loading branch information
cdubz committed Sep 17, 2021
1 parent 8ea68ee commit 45cb439
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 6 deletions.
25 changes: 22 additions & 3 deletions babybuddy/settings/base.py
Expand Up @@ -234,16 +234,35 @@


# 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/
Expand Down
9 changes: 9 additions & 0 deletions babybuddy/static_src/scss/forms.scss
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions babybuddy/tests/tests_forms.py
Expand Up @@ -75,8 +75,8 @@ def test_user_forms(self):
'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)
Expand Down
6 changes: 6 additions & 0 deletions static/babybuddy/css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified static/babybuddy/css/app.css.gz
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
2 changes: 1 addition & 1 deletion static/staticfiles.json

Large diffs are not rendered by default.

0 comments on commit 45cb439

Please sign in to comment.