diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java index a014bd2a0..646da535d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java @@ -60,6 +60,7 @@ import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.Preferences; import com.todoroo.astrid.actfm.sync.ActFmInvoker; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; +import com.todoroo.astrid.actfm.sync.ActFmServiceException; import com.todoroo.astrid.activity.Eula; import com.todoroo.astrid.gtasks.auth.ModernAuthManager; import com.todoroo.astrid.service.AstridDependencyInjector; @@ -546,6 +547,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener } } + @SuppressWarnings("nls") private void handleError(final Throwable e) { DialogUtilities.dismissDialog(this, progressDialog); exceptionService.reportError("astrid-sharing-login", e); //$NON-NLS-1$ @@ -553,7 +555,19 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener runOnUiThread(new Runnable() { @Override public void run() { - errors.setText(e.getMessage()); + String message = e.getMessage(); + if (e instanceof ActFmServiceException) { + ActFmServiceException ae = (ActFmServiceException) e; + JSONObject result = ae.result; + if (result != null && result.has("code")) { + String code = result.optString("code"); + if ("user_exists".equals(code)) + message = getString(R.string.actfm_ALA_error_user_exists); + else if ("incorrect_password".equals(code)) + message = getString(R.string.actfm_ALA_error_wrong_password); + } + } + errors.setText(message); errors.setVisibility(View.VISIBLE); } }); diff --git a/astrid/res/values/strings-actfm.xml b/astrid/res/values/strings-actfm.xml index bc7a8b8de..6a7f0e6ec 100644 --- a/astrid/res/values/strings-actfm.xml +++ b/astrid/res/values/strings-actfm.xml @@ -271,6 +271,12 @@ Please log in: + + User already exists. Please sign in instead. + + + Sorry, that password was incorrect. Please try again. + Copy list