Commit e2c451e0 authored by Dmitry Shelepnev's avatar Dmitry Shelepnev
Browse files

Check is_authenticated in Basic AUTH mechanizm. Check is_authenticated before...

Check is_authenticated in Basic AUTH mechanizm. Check is_authenticated before attempt add book on bookshelf
parent 274f8171
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ def Download(request, book_id, zip_flag):
    """ Загрузка файла книги """
    book = Book.objects.get(id=book_id)

    if settings.AUTH:
    if settings.AUTH and request.user.is_authenticated():
        bookshelf.objects.get_or_create(user=request.user, book=book)

    full_path=os.path.join(settings.ROOT_LIB,book.path)
@@ -149,7 +149,7 @@ def ConvertFB2(request, book_id, convert_type):
    if book.format!='fb2':
        raise Http404

    if settings.AUTH:
    if settings.AUTH and request.user.is_authenticated():
        bookshelf.objects.get_or_create(user=request.user, book=book)

    full_path=os.path.join(settings.ROOT_LIB,book.path)
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@ class AuthFeed(Feed):
    request = None
    def __call__(self,request,*args,**kwargs):
        self.request = request
        if settings.AUTH:
            if request.user.is_authenticated():
                return super().__call__(request,*args,**kwargs)
        
        bau = BasicAuthMiddleware()
        result=bau.process_request(self.request)