Feat login required (#204)

* global login required option

* add option to require global login
This commit is contained in:
Markos Gogoulos 2021-06-02 17:18:06 +03:00 committed by GitHub
parent 171b9f84d7
commit 748d4bae4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -427,6 +427,10 @@ CELERY_BEAT_SCHEDULE = {
LOCAL_INSTALL = False
# this is an option to make the whole portal available to logged in users only
# it is placed here so it can be overrided on local_settings.py
GLOBAL_LOGIN_REQUIRED = False
try:
# keep a local_settings.py file for local overrides
from .local_settings import *
@ -446,3 +450,12 @@ if LOCAL_INSTALL:
SSL_FRONTEND_HOST = FRONTEND_HOST.replace("http", "https")
else:
SSL_FRONTEND_HOST = FRONTEND_HOST
if GLOBAL_LOGIN_REQUIRED:
# this should go after the AuthenticationMiddleware middleware
MIDDLEWARE.insert(5, "login_required.middleware.LoginRequiredMiddleware")
LOGIN_REQUIRED_IGNORE_PATHS = [
r'/accounts/login/$',
r'/accounts/logout/$',
r'/accounts/signup/$',
]

View File

@ -29,11 +29,14 @@ m3u8
django-ckeditor
django-login-required-middleware==0.6.1
# extra nice utilities!
rpdb
tqdm
ipython
flake8
pylint
pep8
django-silk
django-debug-toolbar