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/6] 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/6] 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/6] 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/6] 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) { From f6437e25a73e90f03d1a7569b9507206aa960cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ollie=20the=20otter=20=7E=20=F0=9F=A6=A6?= Date: Thu, 19 Feb 2026 22:49:26 +0000 Subject: [PATCH 5/6] formatted --- commet/lib/ui/pages/login/login_page.dart | 58 +++++++++++++---------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/commet/lib/ui/pages/login/login_page.dart b/commet/lib/ui/pages/login/login_page.dart index 2f81398f6..4428b5b2b 100644 --- a/commet/lib/ui/pages/login/login_page.dart +++ b/commet/lib/ui/pages/login/login_page.dart @@ -20,31 +20,35 @@ class LoginPage extends StatefulWidget { State createState() => LoginPageState(); } - class LoginPageState extends State { - String get messageLoginFailed => Intl.message("Login Failed...", - name: "messageLoginFailed", - desc: "Generic text to show that an attempted login has failed"); - - 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, usually an invalid username or password."); + String get messageLoginFailed => Intl.message( + "Login Failed...", + name: "messageLoginFailed", + desc: "Generic text to show that an attempted login has failed", + ); + + 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, usually an invalid username or password.", + ); String get messageAlreadyLoggedIn => Intl.message( - "You have already logged in to this account", - name: "messageAlreadyLoggedIn", - desc: - "An error message displayed when the user attempts to add an account which has already been logged in to on this device", - ); + "You have already logged in to this account", + name: "messageAlreadyLoggedIn", + desc: + "An error message displayed when the user attempts to add an account which has already been logged in to on this device", + ); StreamSubscription? progressSubscription; double? progress; List? loginFlows; Client? loginClient; - final Debouncer homeserverUpdateDebouncer = - Debouncer(delay: const Duration(seconds: 1)); + final Debouncer homeserverUpdateDebouncer = Debouncer( + delay: const Duration(seconds: 1), + ); bool loadingServerInfo = false; bool isServerValid = false; @@ -56,8 +60,9 @@ class LoginPageState extends State { MatrixClient.create(internalId).then((client) { loginClient = client; - progressSubscription = loginClient!.connectionStatusChanged.stream - .listen(onLoginProgressChanged); + progressSubscription = loginClient!.connectionStatusChanged.stream.listen( + onLoginProgressChanged, + ); }); super.initState(); @@ -113,7 +118,7 @@ class LoginPageState extends State { LoginResult.failed => messageLoginFailed, LoginResult.error => messageLoginIncorrect, LoginResult.alreadyLoggedIn => messageAlreadyLoggedIn, - LoginResult.cancelled => "Login cancelled" + LoginResult.cancelled => "Login cancelled", }; if (message != null) { @@ -121,11 +126,13 @@ class LoginPageState extends State { 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.") - ); - }; + 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) { clientManager?.addClient(loginClient!); @@ -139,7 +146,10 @@ class LoginPageState extends State { } Future doPasswordLogin( - PasswordLoginFlow flow, String username, String password) async { + PasswordLoginFlow flow, + String username, + String password, + ) async { if (loginClient == null) return; flow.username = username; flow.password = password; From 89cd519dc36ac9d48d80081370e64bafdff96e45 Mon Sep 17 00:00:00 2001 From: Airyzz <36567925+Airyzz@users.noreply.github.com> Date: Sat, 28 Feb 2026 18:09:21 +1030 Subject: [PATCH 6/6] Update login_page.dart --- commet/lib/ui/pages/login/login_page.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commet/lib/ui/pages/login/login_page.dart b/commet/lib/ui/pages/login/login_page.dart index 13451da59..01a6b657a 100644 --- a/commet/lib/ui/pages/login/login_page.dart +++ b/commet/lib/ui/pages/login/login_page.dart @@ -10,6 +10,7 @@ import 'package:commet/utils/rng.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:commet/ui/navigation/adaptive_dialog.dart'; +import 'package:tiamat/tiamat.dart' as tiamat; class LoginPage extends StatefulWidget { const LoginPage({super.key, this.onSuccess, this.canNavigateBack = false}); @@ -129,12 +130,11 @@ class LoginPageState extends State { 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.", + builder: (_) => tiamat.Text( + message, ), ); } - ; } if (result is LoginResultSuccess) {