2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 11:35:41 +00:00

fix login middleware

This commit is contained in:
Matthias Mair
2024-10-28 20:52:38 +01:00
parent 98535f6529
commit 5a2eaf77ec
3 changed files with 1 additions and 9 deletions

View File

@ -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'),
]

View File

@ -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/')

View File

@ -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',
),
]