Updating changes to allow for disabling login

This commit is contained in:
Matt Meno
2018-02-01 17:17:05 -05:00
committed by Matt
parent 7f97716ae9
commit 516bc48a33
3 changed files with 18 additions and 3 deletions

View File

@@ -78,12 +78,14 @@ if os.getenv("PAPERLESS_INSTALLED_APPS"):
INSTALLED_APPS += os.getenv("PAPERLESS_INSTALLED_APPS").split(",")
#Default Django authentication middleware (requires a username/password)
AUTH_CLASSES = [\
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware']
if bool(os.getenv("PAPERLESS_DISABLE_AUTH","true").lower() in ("yes", "y", "1", "t", "true")):
AUTH_CLASSES = ['auto_auth.Middleware']
#If AUTH is disabled, we just use our "bypass" authentication middleware
if bool(os.getenv("PAPERLESS_DISABLE_LOGIN","false").lower() in ("yes", "y", "1", "t", "true")):
AUTH_CLASSES = ['paperless.auto_auth.Middleware']
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',