Skip to content

Commit

Permalink
#696 Change invalid credentials on sign in error message (#831)
Browse files Browse the repository at this point in the history
* 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 86cc5de.

* Revert "#696 Remove unsused variable"

This reverts commit b16ca42.

* Revert "Remove useless test"

This reverts commit 20c5d37.

* #696 Add back "login_error_invalid_universal_code" error message

* [BOT] Applying version.

---------

Co-authored-by: EffBureau <[email protected]>
  • Loading branch information
EffBureau and EffBureau authored Aug 7, 2023
1 parent 830be4e commit 400dad1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env bash

flutter format .
git add -u
flutter format .
5 changes: 1 addition & 4 deletions l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions l10n/intl_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -313,4 +312,4 @@
"ticket_status_open": "Ouvert",
"ticket_status_closed": "Fermé",
"loading": "Chargement..."
}
}
4 changes: 2 additions & 2 deletions lib/core/viewmodels/login_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class LoginViewModel extends BaseViewModel {
/// Try to authenticate the user. Redirect to the [DashboardView] if everything is correct
Future<String> authenticate() async {
if (!canSubmit) {
return _appIntl.error;
return _appIntl.login_error_invalid_credentials;
}

setBusy(true);
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions test/viewmodels/login_viewmodel_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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, "");
});
});
Expand Down

0 comments on commit 400dad1

Please sign in to comment.