Chore: Adds additional rules for Ruff linter (#5660)

This commit is contained in:
Trenton H
2024-02-05 13:46:59 -08:00
committed by GitHub
parent d0091ce02c
commit 9943f36be3
13 changed files with 117 additions and 99 deletions

View File

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