mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-19 12:36:06 +00:00
bugfix: no more circular redirects to /firstboot
This commit is contained in:
parent
f7c425384d
commit
cde5f25239
@ -13,11 +13,15 @@ class FirstBootMiddleware:
|
||||
""" Forward to firstboot page if firstboot isn't finished yet """
|
||||
def process_request(self, request):
|
||||
with sqlite_db(cfg.store_file, table='firstboot') as database:
|
||||
first_boot_url = reverse('first_boot:index')
|
||||
if not 'state' in database:
|
||||
# Permanent redirect causes the browser to cache the redirect,
|
||||
# preventing the user from navigating to /plinth until the
|
||||
# browser is restarted.
|
||||
return HttpResponseRedirect(reverse('first_boot:index'))
|
||||
if hasattr(request, 'url') and request.url != first_boot_url:
|
||||
# Permanent redirect causes the browser to cache the
|
||||
# redirect, preventing the user from navigating to /plinth
|
||||
# until the browser is restarted.
|
||||
return HttpResponseRedirect(first_boot_url)
|
||||
else:
|
||||
return
|
||||
|
||||
if database['state'] < 5:
|
||||
LOGGER.info('First boot state - %d', database['state'])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user