From 9d7d0ff5bbd7fefd77719a1a17a50417f892e4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ollie=20the=20otter=20=7E=20=F0=9F=A6=A6?= Date: Mon, 16 Feb 2026 16:09:14 +0000 Subject: [PATCH 1/4] Alternative solution for better login errors --- commet/lib/ui/pages/login/login_page.dart | 27 +++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/commet/lib/ui/pages/login/login_page.dart b/commet/lib/ui/pages/login/login_page.dart index 5c222cc45..2996e97c6 100644 --- a/commet/lib/ui/pages/login/login_page.dart +++ b/commet/lib/ui/pages/login/login_page.dart @@ -21,11 +21,11 @@ class LoginPage extends StatefulWidget { class LoginPageState extends State { String get messageLoginFailed => Intl.message("Login Failed...", - name: "messageLoginFailed", + name: "messageLoginFail", desc: "Generic text to show that an attempted login has failed"); - String get messageLoginError => Intl.message("An error occured", - name: "messageLoginError", + String get messageLoginError => Intl.message("Incorrect username or password.", + name: "messageLoginIncorrect", desc: "A generic error message to convey that an error occured when attempting to login"); @@ -116,14 +116,27 @@ class LoginPageState extends State { if (message != null) { if (mounted) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(message), - ), + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text('Login error'), + content: Text(message), + actions: [ + TextButton( + child: Text('OK'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, ); } } + if (result == LoginResult.success) { clientManager?.addClient(loginClient!); widget.onSuccess?.call(loginClient!); From 490ec21abd1c4b1d2985e52dfed3cf854dae0569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ollie=20the=20otter=20=7E=20=F0=9F=A6=A6?= Date: Tue, 17 Feb 2026 13:28:21 +0000 Subject: [PATCH 2/4] Updating variables --- commet/lib/ui/pages/login/login_page.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commet/lib/ui/pages/login/login_page.dart b/commet/lib/ui/pages/login/login_page.dart index 2996e97c6..ac85adbd2 100644 --- a/commet/lib/ui/pages/login/login_page.dart +++ b/commet/lib/ui/pages/login/login_page.dart @@ -21,13 +21,13 @@ class LoginPage extends StatefulWidget { class LoginPageState extends State { String get messageLoginFailed => Intl.message("Login Failed...", - name: "messageLoginFail", + name: "messageLoginFailed", desc: "Generic text to show that an attempted login has failed"); - String get messageLoginError => Intl.message("Incorrect username or password.", + String get messageLoginIncorrect => Intl.message("Incorrect username or password.", name: "messageLoginIncorrect", desc: - "A generic error message to convey that an error occured when attempting to login"); + "A generic error message to convey that an error occured when attempting to login, usually an invalid username or password."); String get messageAlreadyLoggedIn => Intl.message( "You have already logged in to this account", @@ -109,7 +109,7 @@ class LoginPageState extends State { String? message = switch (result) { LoginResult.success => null, LoginResult.failed => messageLoginFailed, - LoginResult.error => messageLoginError, + LoginResult.error => messageLoginIncorrect, LoginResult.alreadyLoggedIn => messageAlreadyLoggedIn, LoginResult.cancelled => "Login cancelled" }; From de64d00afd4b435a4f09ff3095747a4d865f0be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ollie=20the=20otter=20=7E=20=F0=9F=A6=A6?= Date: Tue, 17 Feb 2026 13:41:52 +0000 Subject: [PATCH 3/4] use showAdaptiveDialog --- commet/lib/ui/pages/login/login_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commet/lib/ui/pages/login/login_page.dart b/commet/lib/ui/pages/login/login_page.dart index ac85adbd2..feb33897e 100644 --- a/commet/lib/ui/pages/login/login_page.dart +++ b/commet/lib/ui/pages/login/login_page.dart @@ -116,7 +116,7 @@ class LoginPageState extends State { if (message != null) { if (mounted) { - showDialog( + showAdaptiveDialog( context: context, builder: (context) { return AlertDialog( From 6faf636aef2d544de97ed91cc13ab5740e9e17d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ollie=20the=20otter=20=7E=20=F0=9F=A6=A6?= Date: Tue, 17 Feb 2026 14:57:38 +0000 Subject: [PATCH 4/4] Realiing the error of my ways --- commet/lib/ui/pages/login/login_page.dart | 26 +++++++---------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/commet/lib/ui/pages/login/login_page.dart b/commet/lib/ui/pages/login/login_page.dart index feb33897e..2f81398f6 100644 --- a/commet/lib/ui/pages/login/login_page.dart +++ b/commet/lib/ui/pages/login/login_page.dart @@ -9,6 +9,7 @@ import 'package:commet/utils/debounce.dart'; import 'package:commet/utils/rng.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:commet/ui/navigation/adaptive_dialog.dart'; class LoginPage extends StatefulWidget { const LoginPage({super.key, this.onSuccess, this.canNavigateBack = false}); @@ -19,6 +20,7 @@ class LoginPage extends StatefulWidget { State createState() => LoginPageState(); } + class LoginPageState extends State { String get messageLoginFailed => Intl.message("Login Failed...", name: "messageLoginFailed", @@ -116,25 +118,13 @@ class LoginPageState extends State { if (message != null) { if (mounted) { - showAdaptiveDialog( - context: context, - builder: (context) { - return AlertDialog( - title: Text('Login error'), - content: Text(message), - actions: [ - TextButton( - child: Text('OK'), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); + AdaptiveDialog.show( + context, + title: "Login failed", + builder: (_) => Text("Incorrect login. Ensure that you have entered your username and password correctly, and that you have entered the homeserver address correctly.") + ); + }; } - } if (result == LoginResult.success) {