Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions app/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ License.
<string name="personalid_this_is_not_me"><u>Ce n\'est pas moi</u></string>
<string name="personalid_welcome_back_msg">Bon retour %s</string>
<string name="personalid_recovery_failed_title">La récupération a échoué</string>
<string name="personalid_recovery_lockout_title">Compte Verrouillé</string>
<string name="personalid_recovery_failed_message">Il semble que vous ayez oublié votre code de sauvegarde, nous créons un nouveau compte pour vous</string>
<string name="personalid_recovery_lockout_message">Vous avez saisi le mauvais code de sauvegarde trop de fois et votre compte a été verrouillé.</string>
<string name="personalid_wrong_backup_message">Vous avez saisi un code de secours erroné. Veuillez réessayer. Vous devrez créer un nouveau compte après %d tentatives incorrectes.</string>
<string name="personalid_camera_permission_title">Autorisation pour la caméra</string>
<string name="personalid_camera_permission_msg">Afin de prendre une photo, CommCare a besoin de l\'autorisation d\'utiliser l\'appareil photo de votre appareil.</string>
Expand Down
2 changes: 2 additions & 0 deletions app/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@
<string name="personalid_this_is_not_me"><u>Este não sou eu</u></string>
<string name="personalid_welcome_back_msg">Bem-vindo de volta %s</string>
<string name="personalid_recovery_failed_title">Falha na recuperação</string>
<string name="personalid_recovery_lockout_title">Conta Bloqueada</string>
<string name="personalid_recovery_failed_message">Parece que se esqueceu do seu código de backup, estamos a criar uma nova conta para si</string>
<string name="personalid_recovery_lockout_message">Introduziu o Código de Backup errado muitas vezes e a sua conta foi bloqueada.</string>
<string name="personalid_wrong_backup_message">Introduziu o Código de Backup errado. Tente novamente. Terá de criar uma nova conta após %d tentativas incorretas.</string>
<string name="personalid_camera_permission_title">Permissão para câmara</string>
<string name="personalid_camera_permission_msg">Para tirar uma fotografia, o CommCare precisa de permissão para utilizar a câmara do seu dispositivo.</string>
Expand Down
2 changes: 2 additions & 0 deletions app/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,10 @@
<string name="personalid_this_is_not_me"><u>Huyu si mimi</u></string>
<string name="personalid_welcome_back_msg">Karibu tena %s</string>
<string name="personalid_recovery_failed_title">Urejeshaji haukufaulu</string>
<string name="personalid_recovery_lockout_title">Akaunti Imefungwa</string>
<string name="personalid_recovery_failed_message">Inaonekana umesahau Nambari yako ya Hifadhi Nambari, tunakuundia akaunti mpya</string>
<string name="personalid_wrong_backup_message">Umeweka Nambari ya Hifadhi Nambari isiyo sahihi, tafadhali jaribu tena. Utahitaji kuunda akaunti mpya baada ya majaribio %d zaidi yasiyo sahihi.</string>
<string name="personalid_recovery_lockout_message">Umeweka Nambari ya Hifadhi Nambari isiyo sahihi mara nyingi sana na akaunti yako imefungwa.</string>
<string name="personalid_camera_permission_title">Ruhusa ya kamera</string>
<string name="personalid_camera_permission_msg">Ili kupiga picha, CommCare inahitaji ruhusa ya kutumia kamera ya kifaa chako.</string>
<string name="personalid_capture_photo">Piga Picha</string>
Expand Down
2 changes: 2 additions & 0 deletions app/res/values-ti/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@
<string name="personalid_this_is_not_me"><u>እዚ ኣነ ኣይኮንኩን።</u></string>
<string name="personalid_welcome_back_msg">እንቋዕ ብደሓን መጻእኩም %s</string>
<string name="personalid_recovery_failed_title">ምሕዋይ ኣይተዓወተን</string>
<string name="personalid_recovery_lockout_title">ኣካውንት ተዓጽዩ።</string>
<string name="personalid_recovery_failed_message">Backup Code ናትካ ዝረሳዕካዮ ይመስል፣ ሓድሽ ኣካውንት ንፈጥር ኣለና።</string>
<string name="personalid_recovery_lockout_message">ጌጋ Backup Code ብዙሕ ግዜ ኣእቲኻ ኣካውንትካ ተዓጽዩ ኣሎ።</string>
<string name="personalid_wrong_backup_message">ጌጋ Backup Code ኣእቲኻ፡ በጃኻ ደጊምካ ፈትን። ድሕሪ %d ዝያዳ ዘይቅኑዕ ፈተነታት ሓድሽ ኣካውንት ክትፈጥር ከድልየካ እዩ።</string>
<string name="personalid_camera_permission_title">ፍቓድ ንካሜራ</string>
<string name="personalid_camera_permission_msg">ስእሊ ንምውሳድ፡ ኮምኬር ናይ መሳርሒኻ ካሜራ ንኽጥቀም ፍቓድ የድልዮ።</string>
Expand Down
2 changes: 2 additions & 0 deletions app/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,9 @@
<string name="personalid_this_is_not_me"><u>This is not me</u></string>
<string name="personalid_welcome_back_msg">Welcome back %s</string>
<string name="personalid_recovery_failed_title">Recovery failed</string>
<string name="personalid_recovery_lockout_title">Account Locked</string>
<string name="personalid_recovery_failed_message">Looks like you’ve forgotten your Backup Code, we’re creating a new account for you</string>
<string name="personalid_recovery_lockout_message">You have entered the wrong Backup Code too many times and your account has been locked.</string>
<string name="personalid_wrong_backup_message">You entered the wrong Backup Code, please try again. You will need to create a new account after %d more incorrect attempts.</string>
<string name="personalid_camera_permission_title">Permission for camera</string>
<string name="personalid_camera_permission_msg">In order to take a picture, CommCare needs permission to use your device camera.</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/org/commcare/connect/ConnectConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ public class ConnectConstants {
public final static int PERSONALID_RECOVERY_WRONG_BACKUPCODE = ConnectConstants.PERSONAL_ID_TASK_ID_OFFSET + 7;
public final static int PERSONALID_DEVICE_CONFIGURATION_FAILED = ConnectConstants.PERSONAL_ID_TASK_ID_OFFSET + 8;
public final static int PERSONALID_RECOVERY_ACCOUNT_ORPHANED = ConnectConstants.PERSONAL_ID_TASK_ID_OFFSET + 9;
public final static int PERSONALID_RECOVERY_ACCOUNT_LOCKED = ConnectConstants.PERSONAL_ID_TASK_ID_OFFSET + 10;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public void parse(JSONObject json, PersonalIdSessionData sessionData) throws JSO
if (json.has("attempts_left")) {
sessionData.setAttemptsLeft(json.getInt("attempts_left"));
}
if (json.has("error_code")) {
sessionData.setSessionFailureCode(json.getString("error_code"));
}
sessionData.setOauthPassword(JsonExtensions.optStringSafe(json, "password", null));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,9 @@ private void confirmBackupCode() {
protected void onSuccess(PersonalIdSessionData sessionData) {
if (sessionData.getDbKey() != null) {
handleSuccessfulRecovery();
} else if (sessionData.getAttemptsLeft() != null && sessionData.getAttemptsLeft() == 0) {
navigateWithMessage(getString(R.string.personalid_recovery_failed_title),
getString(R.string.personalid_recovery_failed_message),
ConnectConstants.PERSONALID_RECOVERY_ACCOUNT_ORPHANED);
} else if (sessionData.getSessionFailureCode() != null &&
sessionData.getSessionFailureCode().equalsIgnoreCase("LOCKED_ACCOUNT")) {
handleAccountLockout();
Comment on lines -205 to +207
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If server keep sending both attempts_left and error_code and if app checks first for error_code before attempts_left, it should support both versions of users?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't really want to support orphaned account any more which is why we are removing attempts_left ==0 check.

} else if (sessionData.getAttemptsLeft() != null && sessionData.getAttemptsLeft() > 0) {
handleFailedBackupCodeAttempt();
}
Expand Down Expand Up @@ -253,6 +252,14 @@ private void handleFailedBackupCodeAttempt() {
ConnectConstants.PERSONALID_RECOVERY_WRONG_BACKUPCODE);
}

private void handleAccountLockout() {
logRecoveryResult(false);
clearBackupCodeFields();
navigateWithMessage(getString(R.string.personalid_recovery_lockout_title),
getString(R.string.personalid_recovery_lockout_message),
ConnectConstants.PERSONALID_RECOVERY_ACCOUNT_LOCKED);
}

private void logRecoveryResult(boolean success) {
FirebaseAnalyticsUtil.reportCccRecovery(success, AnalyticsParamValue.CCC_RECOVERY_METHOD_BACKUPCODE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;

import org.commcare.activities.SettingsHelper;
import org.commcare.activities.connect.PersonalIdActivity;
import org.commcare.activities.connect.viewmodel.PersonalIdSessionDataViewModel;
import org.commcare.android.database.connect.models.PersonalIdSessionData;
import org.commcare.connect.ConnectConstants;
Expand Down Expand Up @@ -120,7 +119,6 @@ private void handleContinueButtonPress() {
private void finish() {
NavDirections directions = null;
Activity activity = requireActivity();
PersonalIdActivity personalIdActivity = (PersonalIdActivity)activity;
switch (callingClass) {
case ConnectConstants.PERSONALID_REGISTRATION_SUCCESS, ConnectConstants.PERSONALID_RECOVERY_SUCCESS:
successFlow(activity);
Expand All @@ -138,17 +136,16 @@ private void finish() {

break;
case ConnectConstants.PERSONALID_DEVICE_CONFIGURATION_FAILED:
requireActivity().finish();
case ConnectConstants.PERSONALID_RECOVERY_ACCOUNT_LOCKED:
activity.finish();
break;
case ConnectConstants.PERSONALID_RECOVERY_ACCOUNT_ORPHANED:
personalIdSessionData.setAccountExists(false);
directions = navigateToBackupCode();
break;

}
if (directions != null) {
NavHostFragment.findNavController(this).navigate(directions);

}
}

Expand All @@ -160,11 +157,6 @@ private NavDirections navigateToBackupCode() {
return PersonalIdMessageFragmentDirections.actionPersonalidMessageToPersonalidBackupcode();
}

private NavDirections navigateToPhoneFragment() {
return PersonalIdMessageFragmentDirections.actionPersonalidMessageDisplayToPersonalidPhoneFragment();
}


private void successFlow(Activity activity) {
PersonalIdManager.getInstance().setStatus(PersonalIdManager.PersonalIdStatus.LoggedIn);
ConnectDatabaseHelper.setRegistrationPhase(getActivity(), ConnectConstants.PERSONALID_NO_ACTIVITY);
Expand Down