Enforce device provisioning redirect for all user-facing routes #14074
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #14067
Problem
When a Kolibri device is not provisioned, only the root URL (
/) redirects to the setup wizard.Direct navigation to user-facing routes such as:
/en/learn//en/learn/#/library/en/facility/loads the UI instead and shows messages like “No resources available”, which is confusing and bypasses the required device setup flow.
This allows users to reach parts of the application in an invalid, unprovisioned state.
Root Cause
The provisioning check was implemented only in
RootURLRedirectView.Other views (such as
LearnView) render their templates unconditionally.The existing
ProvisioningErrorHandlermiddleware only handlesDeviceNotProvisionedexceptions and does not proactively block requests. Since these views never raise that exception, the middleware was never triggered.Fix
This change moves provisioning enforcement to the middleware layer so it applies consistently to all requests.
ProvisioningErrorHandlernow checks provisioning status on every requestThis ensures that no user-facing UI is rendered until the device is properly provisioned.
Recording.2026-01-15.232233.mp4
Tests
Added middleware-level regression tests to verify that:
These tests fail on the previous behavior and pass with this change, helping prevent regressions.
Impact