added support for multiple accounts, guardian login bugfixes, ui changes

This commit is contained in:
2026-09-23 20:50:12 +02:00
parent 630497abdd
commit 84098af7e2
37 changed files with 1759 additions and 376 deletions
@@ -10,10 +10,10 @@ import '../queries/auth_verify/auth_verify.dart';
/// Credential probe. For password accounts a server-side password rotation
/// forces a re-login on the next cold start even when the bearer token would
/// still be accepted; for guardians it confirms a rejected token before the
/// session is dropped.
/// session is dropped. Another stored account then takes over.
class SessionValidator {
static Future<void> probeStored({
required Future<void> Function() onInvalidated,
required Future<void> Function(String? nextAccountId) onInvalidated,
}) async {
final session = SessionManager().current;
// The probes use their own dio (bypassing the demo interceptor), so a demo
@@ -29,7 +29,7 @@ class SessionValidator {
} on AuthException catch (e) {
if (e.statusCode != 401) return;
log('MC: stored session rejected — forcing re-login');
await SessionLifecycle.signOut(
final next = await SessionLifecycle.signOut(
notice: switch (session) {
CredentialSession() =>
'Deine Zugangsdaten wurden vom Server abgelehnt. Vermutlich '
@@ -38,7 +38,7 @@ class SessionValidator {
'Deine Anmeldung ist abgelaufen. Bitte melde dich erneut an.',
},
);
await onInvalidated();
await onInvalidated(next);
} catch (e) {
log('MC: background session check failed (transient): $e');
}