55
66import androidx .annotation .NonNull ;
77
8- import com .android .volley .Cache ;
9- import com .android .volley .NetworkResponse ;
10- import com .android .volley .ParseError ;
11- import com .android .volley .Request ;
12- import com .android .volley .RequestQueue ;
13- import com .android .volley .Response ;
14- import com .android .volley .VolleyError ;
15- import com .android .volley .toolbox .HttpHeaderParser ;
16-
178import org .json .JSONArray ;
189import org .json .JSONException ;
1910import org .json .JSONObject ;
4536import javax .inject .Inject ;
4637import javax .inject .Named ;
4738
39+ import com .android .volley .Cache ;
40+ import com .android .volley .NetworkResponse ;
41+ import com .android .volley .ParseError ;
42+ import com .android .volley .Request ;
43+ import com .android .volley .RequestQueue ;
44+ import com .android .volley .Response ;
45+ import com .android .volley .VolleyError ;
46+ import com .android .volley .toolbox .HttpHeaderParser ;
47+
4848public class Authenticator {
4949 private static final String WPCOM_OAUTH_PREFIX = "https://public-api.wordpress.com/oauth2" ;
5050 private static final String WPCOM_PREFIX = "https://wordpress.com" ;
@@ -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
0 commit comments