Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 3b731c3

Browse files
Merge pull request #3110 from wordpress-mobile/issue/12935-update-login-email-endpoint
Updates Authenticator file to use API 1.3 for sign up links
2 parents 800a917 + 717e419 commit 3b731c3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/auth/Authenticator.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public AuthEmailResponsePayload(boolean isSignup) {
9090
}
9191
}
9292

93-
@Inject public Authenticator(Context appContext,
93+
@Inject
94+
public Authenticator(Context appContext,
9495
Dispatcher dispatcher,
9596
@Named("regular") RequestQueue requestQueue,
9697
AppSecrets secrets) {
@@ -248,7 +249,8 @@ public BearerRequest(String appId, String appSecret, String code, Listener liste
248249
}
249250
}
250251

251-
public interface OauthResponse {}
252+
public interface OauthResponse {
253+
}
252254

253255
public static class Token implements OauthResponse {
254256
private String mAccessToken;
@@ -300,8 +302,7 @@ public TwoFactorResponse(JSONObject data) throws JSONException {
300302
}
301303

302304
public void sendAuthEmail(final AuthEmailPayload payload) {
303-
String url = payload.isSignup ? WPCOMREST.auth.send_signup_email.getUrlV1_1()
304-
: WPCOMREST.auth.send_login_email.getUrlV1_3();
305+
String url = WPCOMREST.auth.send_login_email.getUrlV1_3();
305306

306307
Map<String, Object> params = new HashMap<>();
307308
params.put("email", payload.emailOrUsername);
@@ -326,6 +327,10 @@ public void sendAuthEmail(final AuthEmailPayload payload) {
326327
params.put("signup_flow_name", payload.signupFlowName);
327328
}
328329

330+
if (payload.isSignup) {
331+
params.put("create_account", true);
332+
}
333+
329334
WPComGsonRequest request = WPComGsonRequest.buildPostRequest(url, params, AuthEmailWPComRestResponse.class,
330335
new Response.Listener<AuthEmailWPComRestResponse>() {
331336
@Override
@@ -345,7 +350,7 @@ public void onErrorResponse(@NonNull WPComGsonNetworkError error) {
345350
mDispatcher.dispatch(AuthenticationActionBuilder.newSentAuthEmailAction(responsePayload));
346351
}
347352
}
348-
);
353+
);
349354
request.addQueryParameter("locale", LanguageUtils.getPatchedCurrentDeviceLanguage(mAppContext));
350355

351356
mRequestQueue.add(request);

0 commit comments

Comments
 (0)