mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 03:25:42 +00:00
fix login middleware
This commit is contained in:
@ -111,7 +111,6 @@ class AuthRequiredMiddleware:
|
||||
# List of URL endpoints we *do not* want to redirect to
|
||||
urls = [
|
||||
reverse_lazy('account_login'),
|
||||
reverse_lazy('account_logout'),
|
||||
reverse_lazy('admin:login'),
|
||||
reverse_lazy('admin:logout'),
|
||||
]
|
||||
|
@ -32,16 +32,9 @@ class MiddlewareTests(InvenTreeTestCase):
|
||||
# logout
|
||||
self.client.logout()
|
||||
|
||||
# check that static files go through
|
||||
# TODO @matmair re-enable this check
|
||||
# self.check_path('/static/css/inventree.css', 302)
|
||||
|
||||
# check that account things go through
|
||||
self.check_path(reverse('account_login'))
|
||||
|
||||
# logout goes directly to login
|
||||
self.check_path(reverse('account_logout'))
|
||||
|
||||
# check that frontend code is redirected to login
|
||||
response = self.check_path(reverse('stats'), 302)
|
||||
self.assertEqual(response.url, '/accounts/login/?next=/stats/')
|
||||
|
@ -203,7 +203,7 @@ frontendpatterns = [
|
||||
# Add a redirect for login views
|
||||
path(
|
||||
'accounts/login/',
|
||||
RedirectView.as_view(url=settings.FRONTEND_URL_BASE, permanent=False),
|
||||
RedirectView.as_view(url=f'/{settings.FRONTEND_URL_BASE}', permanent=False),
|
||||
name='account_login',
|
||||
),
|
||||
]
|
||||
|
Reference in New Issue
Block a user