[go: nahoru, domu]

Skip to content

Commit

Permalink
Squashed 'libs/login/' changes from aec79e59e2..f52c56b481
Browse files Browse the repository at this point in the history
f52c56b481 Merge pull request #15 from wordpress-mobile/merge-wpa
4ec41ae236 Return better error messages for invalid site url in login flow

git-subtree-dir: libs/login
git-subtree-split: f52c56b481fc9d661e4404280a38012ec1a7a3a6
  • Loading branch information
malinajirka committed May 20, 2019
1 parent 65a19cc commit 099b5a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Patterns;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
Expand Down Expand Up @@ -146,12 +147,19 @@ protected void discover() {
return;
}

if (TextUtils.isEmpty(mSiteAddressInput.getEditText().getText())) {
String cleanedSiteAddress = getCleanedSiteAddress();

if (TextUtils.isEmpty(cleanedSiteAddress)) {
showError(R.string.login_empty_site_url);
return;
}

mRequestedSiteAddress = getCleanedSiteAddress();
if (!Patterns.WEB_URL.matcher(cleanedSiteAddress).matches()) {
showError(R.string.login_invalid_site_url);
return;
}

mRequestedSiteAddress = cleanedSiteAddress;

String cleanedXmlrpcSuffix = UrlUtils.removeXmlrpcSuffix(mRequestedSiteAddress);
mDispatcher.dispatch(SiteActionBuilder.newFetchWpcomSiteByUrlAction(cleanedXmlrpcSuffix));
Expand Down
4 changes: 2 additions & 2 deletions WordPressLoginFlow/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<string name="login_log_in_for_deeplink">Log in to WordPress.com to access the post.</string>
<string name="login_log_in_for_share_intent">Log in to WordPress.com to share the content.</string>
<string name="login_empty_site_url">Please enter a site address</string>
<string name="login_invalid_site_url">The site address you entered is invalid. Please re-enter it.</string>
<string name="login_empty_username">Please enter a username</string>
<string name="login_empty_password">Please enter a password</string>
<string name="login_empty_2fa">Please enter a verification code</string>
Expand Down Expand Up @@ -89,8 +90,7 @@
<string name="logging_in">Logging in</string>
<string name="forgot_password">Lost your password?</string>
<string name="error_generic">An error occurred</string>
<string name="no_site_error">Couldn\'t connect to the WordPress site. There is no valid WordPress site at this
address. Check the site address (URL) you entered.</string>
<string name="no_site_error">The site at this address is not a WordPress site. For us to connect to it, the site must use WordPress.</string>
<string name="invalid_site_url_message">Check that the site URL entered is valid</string>
<string name="xmlrpc_missing_method_error">Couldn\'t connect. Required XML-RPC methods are missing on the server.</string>
<string name="xmlrpc_post_blocked_error">Couldn\'t connect. Your host is blocking POST requests, and the app needs
Expand Down

0 comments on commit 099b5a0

Please sign in to comment.