Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public AuthEmailResponsePayload(boolean isSignup) {
}
}

@Inject public Authenticator(Context appContext,
@Inject
public Authenticator(Context appContext,
Dispatcher dispatcher,
@Named("regular") RequestQueue requestQueue,
AppSecrets secrets) {
Expand Down Expand Up @@ -248,7 +249,8 @@ public BearerRequest(String appId, String appSecret, String code, Listener liste
}
}

public interface OauthResponse {}
public interface OauthResponse {
}

public static class Token implements OauthResponse {
private String mAccessToken;
Expand Down Expand Up @@ -300,8 +302,7 @@ public TwoFactorResponse(JSONObject data) throws JSONException {
}

public void sendAuthEmail(final AuthEmailPayload payload) {
String url = payload.isSignup ? WPCOMREST.auth.send_signup_email.getUrlV1_1()
: WPCOMREST.auth.send_login_email.getUrlV1_3();
String url = WPCOMREST.auth.send_login_email.getUrlV1_3();

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

if (payload.isSignup) {
params.put("create_account", true);
}

WPComGsonRequest request = WPComGsonRequest.buildPostRequest(url, params, AuthEmailWPComRestResponse.class,
new Response.Listener<AuthEmailWPComRestResponse>() {
@Override
Expand All @@ -345,7 +350,7 @@ public void onErrorResponse(@NonNull WPComGsonNetworkError error) {
mDispatcher.dispatch(AuthenticationActionBuilder.newSentAuthEmailAction(responsePayload));
}
}
);
);
request.addQueryParameter("locale", LanguageUtils.getPatchedCurrentDeviceLanguage(mAppContext));

mRequestQueue.add(request);
Expand Down