Skip to content

Commit 85b6eeb

Browse files
chrisbobbegnprice
authored andcommitted
login: Show error dialog on login failure
Fixes-partly: zulip#35
1 parent c59950d commit 85b6eeb

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

0 commit comments

Comments
 (0)