From 55c3c77d80644f2163aca9a600f17051ecd4d5cb Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Wed, 9 Aug 2023 08:44:55 +0200 Subject: [PATCH 1/2] Better handle errors on the forgot password page --- packages/smooth_app/lib/l10n/app_en.arb | 2 ++ .../user_management/forgot_password_page.dart | 6 +++-- packages/smooth_app/pubspec.lock | 27 +++++++++---------- packages/smooth_app/pubspec.yaml | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/packages/smooth_app/lib/l10n/app_en.arb b/packages/smooth_app/lib/l10n/app_en.arb index 13e8bd0ae83..9fceb1f699b 100644 --- a/packages/smooth_app/lib/l10n/app_en.arb +++ b/packages/smooth_app/lib/l10n/app_en.arb @@ -144,6 +144,8 @@ "@user_management": {}, "sign_in_text": "Sign in to your Open Food Facts account to save your contributions", "incorrect_credentials": "Incorrect username or password.", + "password_lost_incorrect_credentials": "This email or username doesn't exist. Please check your credentials.", + "password_lost_server_unavailable": "We are currently experiencing slowdowns on our servers and we apologise for it. Please try again later.", "login": "Login", "@login": { "description": "Text field hint: unified name for either username or e-mail address" diff --git a/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart b/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart index 50c377a9601..86df495072f 100644 --- a/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart +++ b/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart @@ -37,13 +37,15 @@ class _ForgotPasswordPageState extends State } catch (e) { status = null; } - if (status == null) { + if (status == null || status is! int) { _message = appLocalizations.error; } else if (status.status == 200) { _send = true; _message = appLocalizations.reset_password_done; } else if (status.status == 400) { - _message = appLocalizations.incorrect_credentials; + _message = appLocalizations.password_lost_incorrect_credentials; + } else if (status.status as int >= 500) { + _message = appLocalizations.password_lost_server_unavailable; } else { _message = appLocalizations.error; } diff --git a/packages/smooth_app/pubspec.lock b/packages/smooth_app/pubspec.lock index be40abb4662..0494ea2fa3e 100644 --- a/packages/smooth_app/pubspec.lock +++ b/packages/smooth_app/pubspec.lock @@ -598,10 +598,10 @@ packages: dependency: "direct main" description: name: flutter_secure_storage - sha256: "5abe3d5c25ab435e48c47fb61bac25606062a305fac637c2f020e25abd30014a" + sha256: "98352186ee7ad3639ccc77ad7924b773ff6883076ab952437d20f18a61f0a7c5" url: "https://pub.dev" source: hosted - version: "5.1.2" + version: "8.0.0" flutter_secure_storage_linux: dependency: transitive description: @@ -614,10 +614,10 @@ packages: dependency: transitive description: name: flutter_secure_storage_macos - sha256: "388f76fd0f093e7415a39ec4c169ae7cceeee6d9f9ba529d788a13f2be4de7bd" + sha256: "083add01847fc1c80a07a08e1ed6927e9acd9618a35e330239d4422cd2a58c50" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "3.0.0" flutter_secure_storage_platform_interface: dependency: transitive description: @@ -638,10 +638,10 @@ packages: dependency: transitive description: name: flutter_secure_storage_windows - sha256: ca89c8059cf439985aa83c59619b3674c7ef6cc2e86943d169a7369d6a69cab5 + sha256: fc2910ec9b28d60598216c29ea763b3a96c401f0ce1d13cdf69ccb0e5c93c3ee url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "2.0.0" flutter_svg: dependency: "direct main" description: @@ -985,12 +985,11 @@ packages: mobile_scanner: dependency: transitive description: - path: "." - ref: "5aa2c11915467b19dfc5fd3a9e59641d2958ffeb" - resolved-ref: "5aa2c11915467b19dfc5fd3a9e59641d2958ffeb" - url: "https://github.com/openfoodfacts/mobile_scanner.git" - source: git - version: "3.2.1" + name: mobile_scanner + sha256: "9b3d6fb0407f749eb157432b049924277b43ff6948546eeff76260593ad6eca9" + url: "https://pub.dev" + source: hosted + version: "3.4.0" mockito: dependency: "direct dev" description: @@ -1011,10 +1010,10 @@ packages: dependency: "direct main" description: name: openfoodfacts - sha256: "86ef1dc9a3cbb464cb020d6bdd87e52c9115df26cc04ac6144eb80d79a0972e2" + sha256: "4c3e095a20bca11006c957ec37d83fda1178dc03bde0254d4cc29d0eb09ebb3b" url: "https://pub.dev" source: hosted - version: "2.7.4" + version: "2.8.0" openfoodfacts_flutter_lints: dependency: "direct dev" description: diff --git a/packages/smooth_app/pubspec.yaml b/packages/smooth_app/pubspec.yaml index 1330fc10190..cf4d4f2855e 100644 --- a/packages/smooth_app/pubspec.yaml +++ b/packages/smooth_app/pubspec.yaml @@ -99,7 +99,7 @@ dependencies: - openfoodfacts: 2.7.4 + openfoodfacts: 2.8.0 # openfoodfacts: # path: ../../../openfoodfacts-dart From c7f76d5b417d74bcc6ed64c9f73541ae08ad7e51 Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Wed, 9 Aug 2023 16:52:15 +0200 Subject: [PATCH 2/2] Upgrade to 4.8.1 dependency --- packages/smooth_app/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/smooth_app/pubspec.yaml b/packages/smooth_app/pubspec.yaml index cf4d4f2855e..d302334f29b 100644 --- a/packages/smooth_app/pubspec.yaml +++ b/packages/smooth_app/pubspec.yaml @@ -99,7 +99,7 @@ dependencies: - openfoodfacts: 2.8.0 + openfoodfacts: 2.9.0 # openfoodfacts: # path: ../../../openfoodfacts-dart