added support for 2fa login with browser flow
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../routing/app_routes.dart';
|
||||
import '../login_controller.dart';
|
||||
import 'login_error_banner.dart';
|
||||
|
||||
@@ -51,11 +52,27 @@ class _LoginCardState extends State<LoginCard> {
|
||||
Future<void> _submit() async {
|
||||
if (widget.controller.loading) return;
|
||||
if (!(_formKey.currentState?.validate() ?? false)) return;
|
||||
final ok = await widget.controller.submit(
|
||||
final result = await widget.controller.submit(
|
||||
_usernameController.text,
|
||||
_passwordController.text,
|
||||
);
|
||||
if (ok && mounted) widget.onSuccess();
|
||||
if (!mounted) return;
|
||||
switch (result) {
|
||||
case LoginResult.success:
|
||||
widget.onSuccess();
|
||||
case LoginResult.nextcloudLoginRequired:
|
||||
// 2FA (oder abweichendes NC-Passwort): Anmeldung im Browser über den
|
||||
// Login Flow v2 abschließen; ohne Erfolg wird der Login zurückgerollt.
|
||||
final ok = await AppRoutes.openNextcloudLoginFlow(context);
|
||||
if (!mounted) return;
|
||||
if (ok) {
|
||||
widget.onSuccess();
|
||||
} else {
|
||||
await widget.controller.abortNextcloudLogin();
|
||||
}
|
||||
case LoginResult.failure:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InputDecoration _decoration(ThemeData theme, String label, IconData icon) =>
|
||||
|
||||
Reference in New Issue
Block a user