Skip to content

Commit

Permalink
fix: LoginRequiredMiddleware handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav committed Sep 30, 2024
1 parent 815a33f commit bf3432e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/unfold/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@
from django.http import HttpRequest, HttpResponse
from django.template.response import TemplateResponse
from django.urls import URLPattern, path, reverse, reverse_lazy
from django.utils.decorators import method_decorator
from django.utils.functional import lazy
from django.utils.module_loading import import_string
from django.views.decorators.cache import never_cache

try:
from django.contrib.auth.decorators import login_not_required
except ImportError:

def login_not_required(func: Callable) -> Callable:
return func


from .dataclasses import Favicon
from .settings import get_config
Expand Down Expand Up @@ -178,6 +188,8 @@ def search(
},
)

@method_decorator(never_cache)
@login_not_required
def login(
self, request: HttpRequest, extra_context: Optional[Dict[str, Any]] = None
) -> HttpResponse:
Expand Down

0 comments on commit bf3432e

Please sign in to comment.