Skip to content

Commit 516e41f

Browse files
authored
Merge pull request #15 from wordpress-mobile/merge-wpa
Import changes from WPAndroid
2 parents 9e74b32 + c8a874a commit 516e41f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.text.Editable;
1111
import android.text.TextUtils;
1212
import android.text.TextWatcher;
13+
import android.util.Patterns;
1314
import android.view.View;
1415
import android.view.View.OnClickListener;
1516
import android.view.ViewGroup;
@@ -146,12 +147,19 @@ protected void discover() {
146147
return;
147148
}
148149

149-
if (TextUtils.isEmpty(mSiteAddressInput.getEditText().getText())) {
150+
String cleanedSiteAddress = getCleanedSiteAddress();
151+
152+
if (TextUtils.isEmpty(cleanedSiteAddress)) {
150153
showError(R.string.login_empty_site_url);
151154
return;
152155
}
153156

154-
mRequestedSiteAddress = getCleanedSiteAddress();
157+
if (!Patterns.WEB_URL.matcher(cleanedSiteAddress).matches()) {
158+
showError(R.string.login_invalid_site_url);
159+
return;
160+
}
161+
162+
mRequestedSiteAddress = cleanedSiteAddress;
155163

156164
String cleanedXmlrpcSuffix = UrlUtils.removeXmlrpcSuffix(mRequestedSiteAddress);
157165
mDispatcher.dispatch(SiteActionBuilder.newFetchWpcomSiteByUrlAction(cleanedXmlrpcSuffix));

WordPressLoginFlow/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<string name="login_log_in_for_deeplink">Log in to WordPress.com to access the post.</string>
5151
<string name="login_log_in_for_share_intent">Log in to WordPress.com to share the content.</string>
5252
<string name="login_empty_site_url">Please enter a site address</string>
53+
<string name="login_invalid_site_url">The site address you entered is invalid. Please re-enter it.</string>
5354
<string name="login_empty_username">Please enter a username</string>
5455
<string name="login_empty_password">Please enter a password</string>
5556
<string name="login_empty_2fa">Please enter a verification code</string>
@@ -89,8 +90,7 @@
8990
<string name="logging_in">Logging in</string>
9091
<string name="forgot_password">Lost your password?</string>
9192
<string name="error_generic">An error occurred</string>
92-
<string name="no_site_error">Couldn\'t connect to the WordPress site. There is no valid WordPress site at this
93-
address. Check the site address (URL) you entered.</string>
93+
<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>
9494
<string name="invalid_site_url_message">Check that the site URL entered is valid</string>
9595
<string name="xmlrpc_missing_method_error">Couldn\'t connect. Required XML-RPC methods are missing on the server.</string>
9696
<string name="xmlrpc_post_blocked_error">Couldn\'t connect. Your host is blocking POST requests, and the app needs

0 commit comments

Comments
 (0)