Skip to content

Commit 7d9ee82

Browse files
author
AmandaRiu
committed
Send redirectUrl to listener and strip protocol before saving
If the url the user logs in with is redirected, we want to know the redirect url and use that for login. We save this url (or the original url) to app prefs with the protocol stripped since it's not needed for the rest of the login process and can cause issues when looking up the site by the url.
1 parent 8bee4e7 commit 7d9ee82

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

libs/login/src/main/java/org/wordpress/android/login/LoginListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface SelfSignedSSLCallback {
4848
// Login Site Address input callbacks
4949
void alreadyLoggedInWpcom(ArrayList<Integer> oldSitesIds);
5050
void gotWpcomSiteInfo(String siteAddress, String siteName, String siteIconUrl);
51-
void gotConnectedSiteInfo(String siteAddress, boolean hasJetpack);
51+
void gotConnectedSiteInfo(@NonNull String siteAddress, @Nullable String redirectUrl, boolean hasJetpack);
5252
void gotXmlRpcEndpoint(String inputSiteAddress, String endpointAddress);
5353
void handleSslCertificateError(MemorizingTrustManager memorizingTrustManager, SelfSignedSSLCallback callback);
5454
void helpSiteAddress(String url);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,10 @@ public void onFetchedConnectSiteInfo(OnConnectSiteInfoChecked event) {
425425
} else if (event.info.hasJetpack && event.info.isJetpackActive && event.info.isJetpackConnected) {
426426
hasJetpack = true;
427427
}
428-
mLoginListener.gotConnectedSiteInfo(event.info.url, hasJetpack);
428+
mLoginListener.gotConnectedSiteInfo(
429+
event.info.url,
430+
event.info.urlAfterRedirects,
431+
hasJetpack);
429432
}
430433
}
431434
}

0 commit comments

Comments
 (0)