diff --git a/plinth/modules/first_boot/__init__.py b/plinth/modules/first_boot/__init__.py index bf3877710..771de746f 100644 --- a/plinth/modules/first_boot/__init__.py +++ b/plinth/modules/first_boot/__init__.py @@ -19,12 +19,6 @@ first_boot_steps = [ 'url': 'first_boot:welcome', 'order': 0 }, - { - # TODO: Rename this, or merge with 'firstboot_completed'. - 'id': 'firstboot_complete', - 'url': 'first_boot:complete', - 'order': 10 - } ] _all_first_boot_steps = None @@ -96,9 +90,9 @@ def _get_steps(): def next_step(): """Return the resolved next first boot step URL required to go to. - If there are no more step remaining, return index page. + If there are no more step remaining, return 'complete' page. """ - return next_step_or_none() or 'index' + return next_step_or_none() or 'first_boot:complete' def next_step_or_none(): diff --git a/plinth/modules/first_boot/middleware.py b/plinth/modules/first_boot/middleware.py index 2ba122b4a..fee5b2991 100644 --- a/plinth/modules/first_boot/middleware.py +++ b/plinth/modules/first_boot/middleware.py @@ -20,6 +20,7 @@ LOGGER = logging.getLogger(__name__) class FirstBootMiddleware(MiddlewareMixin): """Forward to firstboot page if firstboot isn't finished yet.""" + @staticmethod def process_request(request): """Handle a request as Django middleware request handler.""" @@ -46,11 +47,11 @@ class FirstBootMiddleware(MiddlewareMixin): # If user requests a step other than the welcome step, verify that they # indeed completed the secret verification by looking at the session. - if (user_requests_firstboot and - not request.path.startswith(reverse('first_boot:welcome')) and - first_boot.firstboot_wizard_secret_exists() and - not request.session.get('firstboot_secret_provided', False) and - not is_user_admin(request)): + if (user_requests_firstboot + and not request.path.startswith(reverse('first_boot:welcome')) + and first_boot.firstboot_wizard_secret_exists() + and not request.session.get('firstboot_secret_provided', False) + and not is_user_admin(request)): return HttpResponseRedirect(reverse('first_boot:welcome')) # Redirect to first boot if requesting normal page and first @@ -63,7 +64,7 @@ class FirstBootMiddleware(MiddlewareMixin): # No more steps in first boot first_boot.set_completed() - # Redirect to index page if request firstboot after it is + # Redirect to 'complete' page if user requested firstboot after it is # finished. if firstboot_completed and user_requests_firstboot: - return HttpResponseRedirect(reverse('index')) + return HttpResponseRedirect(reverse('first_boot:complete')) diff --git a/plinth/modules/first_boot/views.py b/plinth/modules/first_boot/views.py index 51ec66145..b66c0adac 100644 --- a/plinth/modules/first_boot/views.py +++ b/plinth/modules/first_boot/views.py @@ -31,22 +31,12 @@ class WelcomeView(FormView): class CompleteView(TemplateView): - """Show summary after all firstboot setup is done. - - After viewing this page the firstboot module can't be accessed anymore. - """ + """Show next steps after all firstboot wizard steps are done.""" template_name = 'firstboot_complete.html' - def get(self, request, *args, **kwargs): - """Mark as done as soon as page is served.""" - response = super().get(self, request, *args, **kwargs) - first_boot.mark_step_done('firstboot_complete') - return response - def get_context_data(self, **kwargs): """Add network connections to context list.""" context = super().get_context_data(**kwargs) context['title'] = _('Setup Complete') - context['firstboot_complete'] = True return context