diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java index 33971d9..15c1c73 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/LoginActivity.java @@ -124,6 +124,7 @@ public class LoginActivity extends AppCompatActivity { //Perform a request on the API to check user credentials and get login tokens final APIRequest params = new APIRequest(this, "user/connectUSER"); + params.setTryContinueOnError(true); params.addString("userMail", ""+login_mail.getText()); params.addString("userPassword", ""+login_password.getText()); @@ -188,11 +189,19 @@ public class LoginActivity extends AppCompatActivity { void handle_server_response(@Nullable APIResponse response){ if(response == null){ - //Hide loading wheel + show_err_server_response(); + return; + } + + if(response.getResponse_code() != 200){ + enter_loading_state(false); - //Put the error on the login mail field - show_form_error(getString(R.string.activity_login_err_invalid_credentials)); + if(response.getResponse_code() == 429) + show_form_error(getString(R.string.activity_login_too_many_request)); + else + show_form_error(getString(R.string.activity_login_err_invalid_credentials)); + return; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2adbf87..9bdf6d3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -232,4 +232,5 @@ Congratulations Your account has been created. You can now sign into your new account to use all the features of Comunic. Sign in + Too many failed login requests. Please try again later…