Add minimum server version check during login#1146
Add minimum server version check during login#1146rolandgeider merged 6 commits intowger-project:masterfrom
Conversation
The app already checks a minimum app version from the server, but the opposite wasn't true — an app could connect to an older server with a different API without any warning. This adds a MIN_SERVER_VERSION constant in the app that is checked against the server version (already fetched in AuthProvider) during both login() and tryAutoLogin(). If the server is too old, the user is silently logged out and returned to the auth screen to connect to a compatible server. Includes unit tests for version string parsing (including Python-style pre-release versions like '2.5.0a2'). Closes #<issue-number>
|
Thanks for the PR! One thing we definitely need is some kind of UI feedback for the user (we can use something similar to the current min app version check), otherwise the users can't tell if this is a bug or they need to do something, like updating their server. |
|
sure I'll see it and update your regarding the same. |
- Enhanced version parsing to handle Python/Django version formats more reliably - Added serverUpdateRequired AuthState for proper UI routing - Improved server version sanitization with better regex patterns - Added UpdateServerScreen with localized user feedback - Integrated into auth flow routing to show appropriate update messages
|
The UI feedback is implemented following the same pattern as the existing min app version check: Added AuthState.serverUpdateRequired — a new auth state that mirrors AuthState.updateRequired Wired into main.dart so auto-login routes to the screen on startup Wired into auth_screen.dart so manual login navigates to the screen after pressing login The flow mirrors UpdateAppScreen exactly — same dialog style, same routing pattern, just pointing the user at the server admin instead of the app store. |
|
I saw the error and this Fixes flaky API-token login test in
This prevents false negatives when the auth form rebuilds/resets after successful submit. |
|
merged, thanks! |
The app already checks a minimum app version from the server, but the
opposite wasn't true — an app could connect to an older server with a
different API without any warning.
This adds a MIN_SERVER_VERSION constant in the app that is checked
against the server version (already fetched in AuthProvider) during
both login() and tryAutoLogin(). If the server is too old, the user
is silently logged out and returned to the auth screen to connect to
a compatible server.
Includes unit tests for version string parsing (including Python-style
pre-release versions like '2.5.0a2').
Closes #1127
Proposed Changes
Add MIN_SERVER_VERSION constant to lib/helpers/consts.dart
Add serverUpdateRequired() method to AuthProvider that parses and
compares the already-fetched serverVersion against MIN_SERVER_VERSION
Call the check in both login() and tryAutoLogin(); silently logout
if the server is too old
Guard auth_screen.dart to only push UpdateAppScreen for genuine
app-update cases, not server-version logouts
Add 11 unit tests covering normal, edge, and malformed version strings
Related Issue(s)
Closes #1127
Please check that the PR fulfills these requirements
dart format .)