From 400dad14c12ecaa7b3d3500cc0f87f0a99e2ab0b Mon Sep 17 00:00:00 2001 From: EffBureau <73148947+EffBureau@users.noreply.github.com> Date: Mon, 7 Aug 2023 09:56:24 -0400 Subject: [PATCH] #696 Change invalid credentials on sign in error message (#831) * Remove git add -u from hook * #696 Add error message for invalid credentials * Remove unused strings * #696 Change expected error message in tests * Remove useless test * #696 Change displayed error message for invalid credentials * #696 Remove obsolete universal code matcher * #696 Change string to something smaller * #696 Remove unsused variable * Revert "#696 Remove obsolete universal code matcher" This reverts commit 86cc5dee38ab878754237d2ca6ce06f6068bac8d. * Revert "#696 Remove unsused variable" This reverts commit b16ca42d549747398ac1908f5062956640886f68. * Revert "Remove useless test" This reverts commit 20c5d37d669bdfb4a9b143efd874b62aacae2177. * #696 Add back "login_error_invalid_universal_code" error message * [BOT] Applying version. --------- Co-authored-by: EffBureau --- .githooks/pre-commit | 3 +-- l10n/intl_en.arb | 5 +---- l10n/intl_fr.arb | 7 +++---- lib/core/viewmodels/login_viewmodel.dart | 4 ++-- pubspec.yaml | 2 +- test/viewmodels/login_viewmodel_test.dart | 6 ++++-- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 5a58e969d..03939fb9d 100644 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,4 +1,3 @@ #!/usr/bin/env bash -flutter format . -git add -u \ No newline at end of file +flutter format . \ No newline at end of file diff --git a/l10n/intl_en.arb b/l10n/intl_en.arb index 8edb72ae5..cd00445e2 100644 --- a/l10n/intl_en.arb +++ b/l10n/intl_en.arb @@ -9,7 +9,6 @@ "session_winter": "Winter", "session_summer": "Summer", "session_without": "No active semester", - "oss_license_title": "Open source licenses", "facebook": "Facebook", "github": "GitHub", "email": "Email", @@ -35,9 +34,8 @@ "login_prompt_password": "Password", "login_action_sign_in": "Sign in", "login_error_invalid_universal_code": "This universal code is invalid", - "login_error_invalid_password": "This password is incorrect", - "login_error_incorrect_password": "This password is incorrect", "login_error_field_required": "This field is required", + "login_error_invalid_credentials": "Universal code or password is invalid. Could be a server error.", "login_info_universal_code": "The format of your universal code is AB12345. It was sent to you by the Bureau du registraire upon your admission.", "login_msg_logout_success": "You have logged out", "login_applets_logo": "Made by", @@ -71,7 +69,6 @@ "schedule_settings_starting_weekday_friday": "Friday", "schedule_settings_starting_weekday_saturday": "Saturday", "schedule_settings_starting_weekday_sunday": "Sunday", - "schedule_error_no_event_found": "No event found", "schedule_select_course_activity": "Select the group of the labo", "schedule_already_today_toast": "Already showing today's schedule", "schedule_calendar_from": "From", diff --git a/l10n/intl_fr.arb b/l10n/intl_fr.arb index dfd485fe3..9e2659b6c 100644 --- a/l10n/intl_fr.arb +++ b/l10n/intl_fr.arb @@ -33,10 +33,9 @@ "login_prompt_universal_code": "Code universel", "login_prompt_password": "Mot de passe", "login_action_sign_in": "Se connecter", - "login_error_invalid_universal_code": "Le code universel est invalide", - "login_error_invalid_password": "Ce mot de passe est erroné", - "login_error_incorrect_password": "Le mot de passe est erroné", + "login_error_invalid_universal_code": "Ce code universel est invalide", "login_error_field_required": "Ce champ est requis", + "login_error_invalid_credentials": "Identifiants invalides. Possiblement une erreur côté serveur.", "login_info_universal_code": "Votre code d'accès universel est sous la forme AB12345. Celui-ci vous a été transmis par le Bureau du registraire lors de votre admission.", "login_msg_logout_success": "Vous vous êtes déconnecté", "login_applets_logo": "Conçue par", @@ -313,4 +312,4 @@ "ticket_status_open": "Ouvert", "ticket_status_closed": "Fermé", "loading": "Chargement..." -} +} \ No newline at end of file diff --git a/lib/core/viewmodels/login_viewmodel.dart b/lib/core/viewmodels/login_viewmodel.dart index 70dcd242b..09a8cb47b 100644 --- a/lib/core/viewmodels/login_viewmodel.dart +++ b/lib/core/viewmodels/login_viewmodel.dart @@ -70,7 +70,7 @@ class LoginViewModel extends BaseViewModel { /// Try to authenticate the user. Redirect to the [DashboardView] if everything is correct Future authenticate() async { if (!canSubmit) { - return _appIntl.error; + return _appIntl.login_error_invalid_credentials; } setBusy(true); @@ -88,7 +88,7 @@ class LoginViewModel extends BaseViewModel { setBusy(false); notifyListeners(); - return _appIntl.error; + return _appIntl.login_error_invalid_credentials; } String mailtoStr(String email, String subject) { diff --git a/pubspec.yaml b/pubspec.yaml index 49f6f8ec3..3e45eb808 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: The 4th generation of ÉTSMobile, the main gateway between the Éco # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 4.23.0+1 +version: 4.23.1+1 environment: sdk: ">=2.10.0 <3.0.0" diff --git a/test/viewmodels/login_viewmodel_test.dart b/test/viewmodels/login_viewmodel_test.dart index a7e1d3c63..aabdf381f 100644 --- a/test/viewmodels/login_viewmodel_test.dart +++ b/test/viewmodels/login_viewmodel_test.dart @@ -120,7 +120,8 @@ void main() { () async { viewModel.validateUniversalCode(universalCodeValid); - expect(await viewModel.authenticate(), appIntl.error); + expect(await viewModel.authenticate(), + appIntl.login_error_invalid_credentials); }); test('with wrong credentials should return a error message', () async { @@ -130,7 +131,8 @@ void main() { viewModel.validateUniversalCode("AA11112"); viewModel.validatePassword(passwordCodeValid); - expect(await viewModel.authenticate(), appIntl.error); + expect(await viewModel.authenticate(), + appIntl.login_error_invalid_credentials); expect(viewModel.password, ""); }); });