Specify backend for auto-login

This commit is contained in:
shamoon 2023-04-24 22:31:34 -07:00
parent 405769dc97
commit 8a505e3b66

View File

@ -10,7 +10,11 @@ class AutoLoginMiddleware(MiddlewareMixin):
def process_request(self, request):
try:
request.user = User.objects.get(username=settings.AUTO_LOGIN_USERNAME)
auth.login(request, request.user)
auth.login(
request=request,
user=request.user,
backend="django.contrib.auth.backends.ModelBackend",
)
except User.DoesNotExist:
pass