Skip to content

Commit

Permalink
-pr review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-dimagi committed Jan 20, 2025
1 parent 775ff3b commit 88d387a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions app/src/org/commcare/connect/network/ApiConnectId.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void linkHqWorker(Context context, String hqUsername, ConnectLinke
Logger.exception("Linking HQ worker", e);
}
}
}


public static AuthInfo.TokenAuth retrieveHqTokenApi(Context context, String hqUsername, String connectToken) {
HashMap<String, Object> params = new HashMap<>();
Expand Down Expand Up @@ -255,7 +255,7 @@ public static void checkPassword(Context context, String phone, String secret,
public static void resetPassword(Context context, String phoneNumber, String recoverySecret,
String newPassword, IApiCallback callback) {

HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("phone", phoneNumber);
params.put("secret_key", recoverySecret);
params.put("password", newPassword);
Expand All @@ -267,7 +267,7 @@ public static void resetPassword(Context context, String phoneNumber, String rec
public static void checkPin(Context context, String phone, String secret,
String pin, IApiCallback callback) {

HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("phone", phone);
params.put("secret_key", secret);
params.put("recovery_pin", pin);
Expand All @@ -283,7 +283,7 @@ public static void changePin(Context context, String username, String password,
AuthInfo authInfo = new AuthInfo.ProvidedAuth(username, password, false);
String token = HttpUtils.getCredential(authInfo);

HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("recovery_pin", pin);

apiService = ApiClient.getClient().create(ApiService.class);
Expand All @@ -297,9 +297,9 @@ public static void checkPhoneAvailable(Context context, String phone, IApiCallba
callApi(context,call,callback);
}

public static boolean registerUser(Context context, String username, String password, String displayName,
public static void registerUser(Context context, String username, String password, String displayName,
String phone, IApiCallback callback) {
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("username", username);
params.put("password", password);
params.put("name", displayName);
Expand All @@ -316,7 +316,7 @@ public static void changePhone(Context context, String username, String password
//Update the phone number with the server
AuthInfo authInfo = new AuthInfo.ProvidedAuth(username, password, false);
String token = HttpUtils.getCredential(authInfo);
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("old_phone_number", oldPhone);
params.put("new_phone_number", newPhone);
apiService = ApiClient.getClient().create(ApiService.class);
Expand All @@ -330,7 +330,7 @@ public static void updateUserProfile(Context context, String username,
//Update the phone number with the server
AuthInfo authInfo = new AuthInfo.ProvidedAuth(username, password, false);
String token = HttpUtils.getCredential(authInfo);
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
if (secondaryPhone != null) {
params.put("secondary_phone", secondaryPhone);
}
Expand All @@ -347,14 +347,14 @@ public static void requestRegistrationOtpPrimary(Context context, String usernam
IApiCallback callback) {
AuthInfo authInfo = new AuthInfo.ProvidedAuth(username, password, false);
String token = HttpUtils.getCredential(authInfo);
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
apiService = ApiClient.getClient().create(ApiService.class);
Call<ResponseBody> call = apiService.validatePhone(token,params);
callApi(context,call,callback);
}

public static void requestRecoveryOtpPrimary(Context context, String phone, IApiCallback callback) {
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("phone", phone);
apiService = ApiClient.getClient().create(ApiService.class);
Call<ResponseBody> call = apiService.requestOTPPrimary(params);
Expand All @@ -363,7 +363,7 @@ public static void requestRecoveryOtpPrimary(Context context, String phone, IApi

public static void requestRecoveryOtpSecondary(Context context, String phone, String secret,
IApiCallback callback) {
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("phone", phone);
params.put("secret_key", secret);
apiService = ApiClient.getClient().create(ApiService.class);
Expand All @@ -375,7 +375,7 @@ public static void requestVerificationOtpSecondary(Context context, String usern
IApiCallback callback) {
AuthInfo authInfo = new AuthInfo.ProvidedAuth(username, password, false);
String basicToken= HttpUtils.getCredential(authInfo);
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
apiService = ApiClient.getClient().create(ApiService.class);
Call<ResponseBody> call = apiService.validateSecondaryPhone(basicToken,params);
callApi(context,call,callback);
Expand All @@ -385,7 +385,7 @@ public static void confirmRegistrationOtpPrimary(Context context, String usernam
String token, IApiCallback callback) {
AuthInfo authInfo = new AuthInfo.ProvidedAuth(username, password, false);
String basicToken= HttpUtils.getCredential(authInfo);
HashMap<String, Object> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("token", token);

apiService = ApiClient.getClient().create(ApiService.class);
Expand Down
2 changes: 1 addition & 1 deletion app/src/org/commcare/connect/network/ConnectSsoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static AuthInfo.TokenAuth retrieveHqSsoTokenSync(Context context, String
if (connectIdToken != null) {
if(!appRecord.getWorkerLinked()) {
//Link user if necessary
ApiConnectId.linkHqWorker(context, hqUsername, appRecord.getPassword(), connectIdToken.bearerToken);
ApiConnectId.linkHqWorker(context, hqUsername, appRecord, connectIdToken.bearerToken);
}

//Retrieve HQ token
Expand Down

0 comments on commit 88d387a

Please sign in to comment.