Restores the print, but as a debug log

This commit is contained in:
Trenton H 2024-02-05 13:28:50 -08:00
parent fe4edd4153
commit 3196c0c02d
2 changed files with 6 additions and 1 deletions

View File

@ -25,7 +25,7 @@ extend-select = [
] ]
# TODO PTH https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth # TODO PTH https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
ignore = ["DJ001", "SIM105", "RUF012"] ignore = ["DJ001", "SIM105", "RUF012"]
#fix = true fix = true
line-length = 88 line-length = 88
respect-gitignore = true respect-gitignore = true
src = ["src"] src = ["src"]

View File

@ -1,3 +1,5 @@
import logging
from django.conf import settings from django.conf import settings
from django.contrib import auth from django.contrib import auth
from django.contrib.auth.middleware import PersistentRemoteUserMiddleware from django.contrib.auth.middleware import PersistentRemoteUserMiddleware
@ -6,6 +8,8 @@ from django.http import HttpRequest
from django.utils.deprecation import MiddlewareMixin from django.utils.deprecation import MiddlewareMixin
from rest_framework import authentication from rest_framework import authentication
logger = logging.getLogger("paperless.auth")
class AutoLoginMiddleware(MiddlewareMixin): class AutoLoginMiddleware(MiddlewareMixin):
def process_request(self, request: HttpRequest): def process_request(self, request: HttpRequest):
@ -35,6 +39,7 @@ class AngularApiAuthenticationOverride(authentication.BaseAuthentication):
and request.headers["Referer"].startswith("http://localhost:4200/") and request.headers["Referer"].startswith("http://localhost:4200/")
): ):
user = User.objects.filter(is_staff=True).first() user = User.objects.filter(is_staff=True).first()
logger.debug(f"Auto-Login with user {user}")
return (user, None) return (user, None)
else: else:
return None return None