Skip to content

Commit

Permalink
feat: Better support errors on the forgot password page (#4493)
Browse files Browse the repository at this point in the history
* Better handle errors on the forgot password page

* Upgrade to 4.8.1 dependency
  • Loading branch information
g123k authored Aug 9, 2023
1 parent 44ea0f5 commit c9fb89a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ class _ForgotPasswordPageState extends State<ForgotPasswordPage>
} 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;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/smooth_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ dependencies:




openfoodfacts: 2.8.0
openfoodfacts: 2.9.0
# openfoodfacts:
# path: ../../../openfoodfacts-dart

Expand Down

0 comments on commit c9fb89a

Please sign in to comment.