Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Better support errors on the forgot password page #4493

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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