From e154e590469d0a4097fcab76802bc8c88d77b1a9 Mon Sep 17 00:00:00 2001 From: AmandaRiu Date: Fri, 12 Oct 2018 17:49:45 -0400 Subject: [PATCH 1/9] Fix NPE crash by disregarding email hint result if fragment view not init --- .../java/org/wordpress/android/login/LoginEmailFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java index ad4ff6010c3b..b31e4df670ef 100644 --- a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java +++ b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java @@ -445,6 +445,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == EMAIL_CREDENTIALS_REQUEST_CODE) { + if (mEmailInput == null) { + // Activity result received before the fragments onCreateView(), disregard result. + return; + } + if (resultCode == RESULT_OK) { Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); mEmailInput.getEditText().setText(credential.getId()); From 5afd47306a43f2523aada82e8b2edada255a319f Mon Sep 17 00:00:00 2001 From: Alex Forcier Date: Tue, 8 Jan 2019 08:36:17 -0500 Subject: [PATCH 2/9] Rename login magic link image asset --- .../{img_email_alert_120dp.xml => login_email_alert.xml} | 0 .../src/main/res/layout-land/login_magic_link_sent_screen.xml | 2 +- .../src/main/res/layout-land/signup_magic_link.xml | 2 +- .../src/main/res/layout/login_magic_link_sent_screen.xml | 2 +- .../src/main/res/layout/signup_magic_link.xml | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename vendored/WordPressLoginFlow/src/main/res/drawable/{img_email_alert_120dp.xml => login_email_alert.xml} (100%) diff --git a/vendored/WordPressLoginFlow/src/main/res/drawable/img_email_alert_120dp.xml b/vendored/WordPressLoginFlow/src/main/res/drawable/login_email_alert.xml similarity index 100% rename from vendored/WordPressLoginFlow/src/main/res/drawable/img_email_alert_120dp.xml rename to vendored/WordPressLoginFlow/src/main/res/drawable/login_email_alert.xml diff --git a/vendored/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_sent_screen.xml b/vendored/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_sent_screen.xml index bc1fe4146925..b38b889f5ce1 100644 --- a/vendored/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_sent_screen.xml +++ b/vendored/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_sent_screen.xml @@ -22,7 +22,7 @@ android:layout_height="@dimen/magic_link_sent_illustration_sz" android:scaleType="centerInside" android:contentDescription="@null" - app:srcCompat="@drawable/img_email_alert_120dp"/> + app:srcCompat="@drawable/login_email_alert"/> + app:srcCompat="@drawable/login_email_alert" > + app:srcCompat="@drawable/login_email_alert"/> + app:srcCompat="@drawable/login_email_alert" > Date: Mon, 21 Jan 2019 10:21:04 -0500 Subject: [PATCH 3/9] Update to Gradle plugin 3.2.1 --- vendored/WordPressLoginFlow/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendored/WordPressLoginFlow/build.gradle b/vendored/WordPressLoginFlow/build.gradle index ce1a8bd956b9..26b5b2d7e5e9 100644 --- a/vendored/WordPressLoginFlow/build.gradle +++ b/vendored/WordPressLoginFlow/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.2.1' } } From 098189761c68b760f38be76ab558969d8fd4edc7 Mon Sep 17 00:00:00 2001 From: Alex Forcier Date: Mon, 21 Jan 2019 10:21:51 -0500 Subject: [PATCH 4/9] Update build tools to 28.0.3 --- vendored/WordPressLoginFlow/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendored/WordPressLoginFlow/build.gradle b/vendored/WordPressLoginFlow/build.gradle index 26b5b2d7e5e9..eb9bc22707ec 100644 --- a/vendored/WordPressLoginFlow/build.gradle +++ b/vendored/WordPressLoginFlow/build.gradle @@ -18,7 +18,7 @@ repositories { android { compileSdkVersion 27 - buildToolsVersion "27.0.3" + buildToolsVersion '28.0.3' defaultConfig { minSdkVersion 16 From f0af0cd8b187b09bba6c6b30390af964baa65053 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Tue, 5 Feb 2019 07:16:48 -0500 Subject: [PATCH 5/9] Use a default progress message to avoid resources not found exception --- .../org/wordpress/android/login/Login2FaFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java index 54047e998469..074e30e44c84 100644 --- a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java +++ b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java @@ -82,7 +82,9 @@ public class Login2FaFragment extends LoginBaseFormFragment imple private WPLoginInputRow m2FaInput; - private @StringRes int mInProgressMessageId; + private static final @StringRes int DEFAULT_PROGRESS_MESSAGE_ID = R.string.logging_in; + private @StringRes int mInProgressMessageId = DEFAULT_PROGRESS_MESSAGE_ID; + ArrayList mOldSitesIDs; private Button mSecondaryButton; @@ -241,7 +243,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { // retrieve mInProgressMessageId before super.onActivityCreated() so the string will be available to the // progress bar helper if in progress if (savedInstanceState != null) { - mInProgressMessageId = savedInstanceState.getInt(KEY_IN_PROGRESS_MESSAGE_ID, 0); + mInProgressMessageId = savedInstanceState.getInt(KEY_IN_PROGRESS_MESSAGE_ID, DEFAULT_PROGRESS_MESSAGE_ID); mOldSitesIDs = savedInstanceState.getIntegerArrayList(KEY_OLD_SITES_IDS); } else { mAnalyticsListener.trackTwoFactorFormViewed(); @@ -370,7 +372,7 @@ private void show2FaError(String message) { @Override protected void endProgress() { super.endProgress(); - mInProgressMessageId = 0; + mInProgressMessageId = DEFAULT_PROGRESS_MESSAGE_ID; } private void handleAuthError(AuthenticationErrorType error, String errorMessage) { From 20224f51c5aa8d1b6cbac00e5157874f676f6ebc Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 6 Feb 2019 07:34:51 -0500 Subject: [PATCH 6/9] Ensure mOldSitesIDs is created --- .../java/org/wordpress/android/login/LoginEmailFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java index b31e4df670ef..65d8d3a9fae1 100644 --- a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java +++ b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java @@ -68,7 +68,7 @@ public class LoginEmailFragment extends LoginBaseFormFragment imp public static final String TAG = "login_email_fragment_tag"; public static final int MAX_EMAIL_LENGTH = 100; - private ArrayList mOldSitesIDs; + private ArrayList mOldSitesIDs = new ArrayList<>(); private GoogleApiClient mGoogleApiClient; private String mGoogleEmail; private String mRequestedEmail; From 582fb0e24bb05a5418be1e082c04bd9a901679b9 Mon Sep 17 00:00:00 2001 From: AmandaRiu Date: Wed, 20 Feb 2019 17:21:30 -0600 Subject: [PATCH 7/9] Upgrade from 4.6 to gradle version 4.10.1 --- vendored/WordPressLoginFlow/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendored/WordPressLoginFlow/build.gradle b/vendored/WordPressLoginFlow/build.gradle index eb9bc22707ec..1451ff82433b 100644 --- a/vendored/WordPressLoginFlow/build.gradle +++ b/vendored/WordPressLoginFlow/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.3.1' } } From e9a4184fb74c4470d7b517da388816cdd7141e75 Mon Sep 17 00:00:00 2001 From: Alex Forcier Date: Mon, 15 Apr 2019 15:51:52 -0400 Subject: [PATCH 8/9] Revert gradle plugin version update Reverts back to the current plugin version used by WPAndroid. --- vendored/WordPressLoginFlow/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendored/WordPressLoginFlow/build.gradle b/vendored/WordPressLoginFlow/build.gradle index 4f0a0d6b832a..2e67d681283c 100644 --- a/vendored/WordPressLoginFlow/build.gradle +++ b/vendored/WordPressLoginFlow/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.1' + classpath 'com.android.tools.build:gradle:3.2.1' } } From 6bcdc967ee53c7866bc214faf203a1a2cb85f355 Mon Sep 17 00:00:00 2001 From: Oguz Kocer Date: Tue, 16 Apr 2019 17:18:26 -0400 Subject: [PATCH 9/9] Return better error messages for invalid site url in login flow --- .../android/login/LoginSiteAddressFragment.java | 12 ++++++++++-- .../src/main/res/values/strings.xml | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java index 1cc525023756..c5d52db215be 100644 --- a/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java +++ b/vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java @@ -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; @@ -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)); diff --git a/vendored/WordPressLoginFlow/src/main/res/values/strings.xml b/vendored/WordPressLoginFlow/src/main/res/values/strings.xml index b218209b6e96..43060a6f5771 100644 --- a/vendored/WordPressLoginFlow/src/main/res/values/strings.xml +++ b/vendored/WordPressLoginFlow/src/main/res/values/strings.xml @@ -50,6 +50,7 @@ Log in to WordPress.com to access the post. Log in to WordPress.com to share the content. Please enter a site address + The site address you entered is invalid. Please re-enter it. Please enter a username Please enter a password Please enter a verification code @@ -89,8 +90,7 @@ Logging in Lost your password? An error occurred - Couldn\'t connect to the WordPress site. There is no valid WordPress site at this - address. Check the site address (URL) you entered. + The site at this address is not a WordPress site. For us to connect to it, the site must use WordPress. Check that the site URL entered is valid Couldn\'t connect. Required XML-RPC methods are missing on the server. Couldn\'t connect. Your host is blocking POST requests, and the app needs