mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-17 10:13:56 -05:00
Updating changes to allow for disabling login
This commit is contained in:
parent
7f97716ae9
commit
516bc48a33
@ -86,6 +86,11 @@ PAPERLESS_PASSPHRASE="secret"
|
|||||||
# https://docs.djangoproject.com/en/1.11/ref/settings/#force-script-name
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#force-script-name
|
||||||
#PAPERLESS_FORCE_SCRIPT_NAME=""
|
#PAPERLESS_FORCE_SCRIPT_NAME=""
|
||||||
|
|
||||||
|
# If you are using alternative authentication means or are just using paperless
|
||||||
|
# as a single user on a small private network, this option allows you to disable
|
||||||
|
# user authentication if you set it to "true"
|
||||||
|
#PAPERLESS_DISABLE_LOGIN=""
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#### Software Tweaks ####
|
#### Software Tweaks ####
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
'''
|
||||||
|
This is a dummy authentication middleware module that creates what
|
||||||
|
is roughly an Anonymous authenticated user so we can disable login
|
||||||
|
and not interfere with existing user ID's.
|
||||||
|
'''
|
||||||
|
|
||||||
class User:
|
class User:
|
||||||
is_superuser = True
|
is_superuser = True
|
||||||
is_active = True
|
is_active = True
|
||||||
is_staff = True
|
is_staff = True
|
||||||
id = 1
|
is_authenticated=True
|
||||||
|
id = -1 #Must be -1 to avoid colliding with possible existing user ID's (that start number at 1)
|
||||||
|
pk = -1
|
||||||
|
|
||||||
def return_true(*args, **kwargs):
|
def return_true(*args, **kwargs):
|
||||||
return True
|
return True
|
||||||
|
@ -78,12 +78,14 @@ if os.getenv("PAPERLESS_INSTALLED_APPS"):
|
|||||||
INSTALLED_APPS += os.getenv("PAPERLESS_INSTALLED_APPS").split(",")
|
INSTALLED_APPS += os.getenv("PAPERLESS_INSTALLED_APPS").split(",")
|
||||||
|
|
||||||
|
|
||||||
|
#Default Django authentication middleware (requires a username/password)
|
||||||
AUTH_CLASSES = [\
|
AUTH_CLASSES = [\
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware']
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware']
|
||||||
|
|
||||||
if bool(os.getenv("PAPERLESS_DISABLE_AUTH","true").lower() in ("yes", "y", "1", "t", "true")):
|
#If AUTH is disabled, we just use our "bypass" authentication middleware
|
||||||
AUTH_CLASSES = ['auto_auth.Middleware']
|
if bool(os.getenv("PAPERLESS_DISABLE_LOGIN","false").lower() in ("yes", "y", "1", "t", "true")):
|
||||||
|
AUTH_CLASSES = ['paperless.auto_auth.Middleware']
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = [
|
MIDDLEWARE_CLASSES = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user