Skip to content

Commit 9bcfc15

Browse files
committed
login: Show error dialog on login failure
Fixes-partly: zulip#35
1 parent b9f01f2 commit 9bcfc15

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/widgets/login.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import '../api/route/realm.dart';
66
import '../api/route/users.dart';
77
import '../model/store.dart';
88
import 'app.dart';
9+
import 'dialog.dart';
910
import 'store.dart';
1011

1112
class _LoginSequenceRoute extends MaterialPageRoute<void> {
@@ -136,9 +137,12 @@ class _EmailPasswordLoginPageState extends State<EmailPasswordLoginPage> {
136137
try {
137138
result = await fetchApiKey(
138139
realmUrl: realmUrl, username: email, password: password);
139-
} on Exception catch (e) { // TODO(#37): distinguish API exceptions
140-
// TODO(#35): give feedback to user on failed login
141-
debugPrint(e.toString());
140+
} on Exception { // TODO(#37): distinguish API exceptions
141+
if (!context.mounted) return;
142+
// TODO(#35) give more helpful feedback. Needs #37. The RN app is
143+
// unhelpful here; we should at least recognize invalid auth errors, and
144+
// errors for deactivated user or realm (see zulip-mobile#4571).
145+
showErrorDialog(context: context, title: 'Login failed');
142146
return;
143147
} finally {
144148
setState(() {

0 commit comments

Comments
 (0)