Handle too many request error on create account form.

This commit is contained in:
Pierre HUBERT 2018-08-20 14:58:49 +02:00
parent b8f732d82b
commit 2f892b4ea4
4 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,11 @@ public enum CreateAccountResult {
*/ */
SUCCESS, SUCCESS,
/**
* Too many account creation requests
*/
ERROR_TOO_MANY_REQUESTS,
/** /**
* Trying to login with an existing email address * Trying to login with an existing email address
*/ */

View File

@ -209,6 +209,9 @@ public class AccountHelper {
case 409: case 409:
return CreateAccountResult.ERROR_EXISTING_EMAIL; return CreateAccountResult.ERROR_EXISTING_EMAIL;
case 429:
return CreateAccountResult.ERROR_TOO_MANY_REQUESTS;
default: default:
return CreateAccountResult.ERROR; return CreateAccountResult.ERROR;

View File

@ -250,6 +250,11 @@ public class CreateAccountActivity extends AppCompatActivity
int message = R.string.err_while_creating_account; int message = R.string.err_while_creating_account;
switch (result){ switch (result){
//Too many account creation requests
case ERROR_TOO_MANY_REQUESTS:
message = R.string.err_create_account_too_many_requests;
break;
//Existing email address //Existing email address
case ERROR_EXISTING_EMAIL: case ERROR_EXISTING_EMAIL:
message = R.string.err_create_account_existing_email; message = R.string.err_create_account_existing_email;

View File

@ -234,4 +234,5 @@
<string name="account_created_sign_in">Sign in</string> <string name="account_created_sign_in">Sign in</string>
<string name="activity_login_too_many_request">Too many failed login requests. Please try again later…</string> <string name="activity_login_too_many_request">Too many failed login requests. Please try again later…</string>
<string name="err_create_account_existing_email">This email address is already associated with an account!</string> <string name="err_create_account_existing_email">This email address is already associated with an account!</string>
<string name="err_create_account_too_many_requests">Too many account creation requests. Please try again later...</string>
</resources> </resources>