[MediaWiki-commits] [Gerrit] Improve the API error handling in the account creation activ... - change (apps...wikipedia)
jenkins-bot has submitted this change and it was merged. Change subject: Improve the API error handling in the account creation activity. .. Improve the API error handling in the account creation activity. * Add support and messages for five more errors the API can give you. * Differentiate between IP blocks and account blocks when presenting messages to the user. * Change ordering of error presentation so that if there are multiple errors then the user is told about the unresolvable ones first so that they don't jump through hoops trying to fix the errors if they'd never be able to anyway (e.g. if they're blocked, don't tell them their password is too short first, just tell them they're blocked). Bug: 70635 Change-Id: I3b991b3dbc3ff74c7b18f7214e98d29bca99f321 --- M wikipedia/res/values-qq/strings.xml M wikipedia/res/values/strings.xml M wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java 3 files changed, 29 insertions(+), 2 deletions(-) Approvals: Dbrant: Looks good to me, approved jenkins-bot: Verified diff --git a/wikipedia/res/values-qq/strings.xml b/wikipedia/res/values-qq/strings.xml index 5e6c80d..f3e90b8 100644 --- a/wikipedia/res/values-qq/strings.xml +++ b/wikipedia/res/values-qq/strings.xml @@ -153,6 +153,12 @@ string name=create_account_password_repeat_hint{{Identical|Repeat password}}/string string name=create_account_passwords_mismatch_error{{Identical|Passwords do not match}}/string string name=create_account_username_exists_errorUsed as error message on creating a user account./string + string name=create_account_noname_errorUsed as an error message during account creation when the account creation failed because username that was provided is invalid./string + string name=create_account_invalid_email_errorUsed as an error message during account creation when the account creation failed because the email that was provided is invalid./string + string name=create_account_password_too_short_errorUsed as an error message during account creation when the account creation failed because the password that was entered is too short./string + string name=create_account_blocked_anon_errorUsed as an error message during account creation when the account creation failed because their IP is blocked./string + string name=create_account_blocked_errorUsed as an error message during account creation when the the account creation failed because their account is blocked./string + string name=create_account_password_name_match_errorUsed as an error message during account creation when the the account creation failed because the username and password provided are the same./string string name=create_account_no_networkMessage shown when the network is unavailable during account creation/string string name=create_account_nextButton text on Create Account screen to go \next\ (to CAPTCHA). {{Identical|Next}}/string diff --git a/wikipedia/res/values/strings.xml b/wikipedia/res/values/strings.xml index bb5d671..c26d73b 100644 --- a/wikipedia/res/values/strings.xml +++ b/wikipedia/res/values/strings.xml @@ -114,6 +114,12 @@ string name=create_account_username_exists_errorUsername already in use/string string name=create_account_ip_throttle_errorToo many accounts created from this IP address. Try again later./string string name=create_account_open_proxy_errorThis IP address has been blocked from creating accounts./string +string name=create_account_noname_errorThe username you provided is invalid. Please provide another username./string +string name=create_account_invalid_email_errorThe email address you provided is invalid./string +string name=create_account_password_too_short_errorThe password you provided is too short./string +string name=create_account_blocked_anon_errorYou cannot create an account because your IP is blocked./string +string name=create_account_blocked_errorYou cannot create an account because your account is blocked./string +string name=create_account_password_name_match_errorYour username and your password must be different./string string name=create_account_generic_errorCould not create account/string string name=create_account_no_networkNo network connection/string string name=create_account_nextNext/string diff --git a/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java b/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java index 11ea65f..77d563e 100644 --- a/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java +++ b/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java @@ -197,12 +197,27 @@ public void handleError(CreateAccountResult result) { String errorCode = result.getResult(); -if (errorCode.equals(userexists)) { -
[MediaWiki-commits] [Gerrit] Improve the API error handling in the account creation activ... - change (apps...wikipedia)
Deskana has uploaded a new change for review. https://gerrit.wikimedia.org/r/159669 Change subject: Improve the API error handling in the account creation activity. .. Improve the API error handling in the account creation activity. * Add support and messages for five more errors the API can give you. * Differentiate between IP blocks and account blocks when presenting messages to the user. * Change ordering of error presentation so that if there are multiple errors then the user is told about the unresolvable ones first so that they don't jump through hoops trying to fix the errors if they'd never be able to anyway (e.g. if they're blocked, don't tell them their password is too short first, just tell them they're blocked). Bug: 70635 Change-Id: I3b991b3dbc3ff74c7b18f7214e98d29bca99f321 --- M wikipedia/res/values/strings.xml M wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java 2 files changed, 23 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/69/159669/1 diff --git a/wikipedia/res/values/strings.xml b/wikipedia/res/values/strings.xml index bb5d671..b62ad15 100644 --- a/wikipedia/res/values/strings.xml +++ b/wikipedia/res/values/strings.xml @@ -114,6 +114,12 @@ string name=create_account_username_exists_errorUsername already in use/string string name=create_account_ip_throttle_errorToo many accounts created from this IP address. Try again later./string string name=create_account_open_proxy_errorThis IP address has been blocked from creating accounts./string +string name=create_account_noname_errorThe username you specified is invalid. Please provide another username./string +string name=create_account_invalid_email_errorThe email address you specified is invalid./string +string name=create_account_password_too_short_errorThe password you provided is too short./string +string name=create_account_blocked_anon_errorYou cannot create an account because your IP is blocked./string +string name=create_account_blocked_errorYou cannot create an account because your account is blocked./string +string name=create_account_password_name_match_errorYour username and your password must be different./string string name=create_account_generic_errorCould not create account/string string name=create_account_no_networkNo network connection/string string name=create_account_nextNext/string diff --git a/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java b/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java index 11ea65f..77d563e 100644 --- a/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java +++ b/wikipedia/src/main/java/org/wikipedia/createaccount/CreateAccountActivity.java @@ -197,12 +197,27 @@ public void handleError(CreateAccountResult result) { String errorCode = result.getResult(); -if (errorCode.equals(userexists)) { - usernameEdit.setError(getString(R.string.create_account_username_exists_error)); +if (errorCode.equals(blocked)) { +if (app.getUserInfoStorage().isLoggedIn()) { +Crouton.makeText(this, R.string.create_account_blocked_error, Style.ALERT).show(); +} else { +Crouton.makeText(this, R.string.create_account_blocked_anon_error, Style.ALERT).show(); +} } else if (errorCode.equals(acct_creation_throttle_hit)) { Crouton.makeText(this, R.string.create_account_ip_throttle_error, Style.ALERT).show(); } else if (errorCode.equals(sorbs_create_account_reason)) { Crouton.makeText(this, R.string.create_account_open_proxy_error, Style.ALERT).show(); +} else if (errorCode.equals(userexists)) { + usernameEdit.setError(getString(R.string.create_account_username_exists_error)); +} else if (errorCode.equals(noname)) { +Crouton.makeText(this, R.string.create_account_noname_error, Style.ALERT).show(); +} else if (errorCode.equals(invalidemailaddress)) { +Crouton.makeText(this, R.string.create_account_invalid_email_error, Style.ALERT).show(); +} else if (errorCode.equals(passwordtooshort)) { +//FIXME: Find the value of $wgMinimalPasswordLength and tell the user the minimum pwd length +Crouton.makeText(this, R.string.create_account_password_too_short_error, Style.ALERT).show(); +} else if (errorCode.equals(password-name-match)) { +Crouton.makeText(this, R.string.create_account_password_name_match_error, Style.ALERT).show(); } else { Crouton.makeText(this, R.string.create_account_generic_error, Style.ALERT).show(); } -- To view, visit https://gerrit.wikimedia.org/r/159669 To unsubscribe, visit