Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
Expand All @@ -22,9 +23,15 @@
import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView;

import java.util.Timer;
import java.util.TimerTask;

public abstract class MifosPassCodeActivity extends AppCompatActivity implements MifosPassCodeView.
PassCodeListener {



private static final int WAIT_TIME = 30 * 1000;
NestedScrollView clRootview;
AppCompatButton btnForgotPasscode;
MifosPassCodeView mifosPassCodeView;
Expand Down Expand Up @@ -207,25 +214,40 @@ public void passCodeEntered(String passcode) {
return;
}

if (counter == 3) {
Toast.makeText(getApplicationContext(), R.string.incorrect_passcode_more_than_three,
else if (counter == 5) {
Toast.makeText(getApplicationContext(), R.string.incorrect_passcode_more_than_five,
Toast.LENGTH_SHORT).show();
clearTokenPreferences();


new Handler().postDelayed(new Runnable() {
@Override
public void run() {
counter=0;
mifosPassCodeView.setEnabled(false);
}
}, WAIT_TIME);
// clearTokenPreferences();
startLoginActivity();
mifosPassCodeView.setEnabled(true);
return;
}

if (isPassCodeLengthCorrect()) {
else if (isPassCodeLengthCorrect()) {
String passwordEntered = encryptPassCode(mifosPassCodeView.getPasscode());
if (passcodePreferencesHelper.getPassCode().equals(passwordEntered)) {
if (resetPasscode) {
resetPasscode();
return;
}
counter = 0;
Toast.makeText(getApplicationContext(), R.string.Login_successfully,
Toast.LENGTH_SHORT).show();
startHomeActivity();
} else {


mifosPassCodeView.startAnimation(shakeAnimation);
counter++;
counter += 1;
mifosPassCodeView.clearPasscodeField();
showToaster(clRootview, R.string.incorrect_passcode);
}
Expand Down
1 change: 0 additions & 1 deletion mifos-passcode/src/main/res/layout/activity_pass_code.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
android:layout_height="@dimen/login_height"
android:layout_marginTop="@dimen/login_margin_top"
android:layout_marginBottom="@dimen/login_padding_top" />

<TextView
android:id="@+id/tv_passcode"
android:layout_width="wrap_content"
Expand Down
3 changes: 2 additions & 1 deletion mifos-passcode/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<string name="enter_passcode">Enter 4 digit Passcode</string>
<string name="error_passcode">Passcode should be of 4 digit</string>
<string name="incorrect_passcode">Incorrect Passcode</string>
<string name="incorrect_passcode_more_than_three">You have entered incorrect Passcode more than 3 times</string>
<string name="incorrect_passcode_more_than_five">You have entered incorrect Passcode more than 5 times, pls wait till 30sec</string>
<string name="skip">Skip</string>
<string name="save">Save</string>
<string name="proceed">Proceed</string>
Expand Down Expand Up @@ -36,4 +36,5 @@
<string name="authentication_cancelled">Authentication Cancelled</string>
<string name="fingerprint">Fingerprint</string>
<string name="FingerprintEnableMessage">Do you want to enable Fingerprint Authentication?</string>
<string name="Login_successfully">Login Successfully</string>
</resources>