Skip to content

Commit

Permalink
fix device lock / biometric prompt throwing exception (you are lost t…
Browse files Browse the repository at this point in the history
…hen -> clear data necessary, not sure if it's really secure, obviously an exception should never be thrown when authentication fails (but this should be handled internally)
  • Loading branch information
hg42 committed Sep 29, 2022
1 parent d0705d5 commit a54094d
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,17 @@ class IntroActivityX : BaseActivity() {
}

private fun launchBiometricPrompt(withBiometric: Boolean) {
val biometricPrompt = createBiometricPrompt(this)
val promptInfo = PromptInfo.Builder()
.setTitle(getString(R.string.prefs_biometriclock))
.setConfirmationRequired(true)
.setAllowedAuthenticators(DEVICE_CREDENTIAL or (if (withBiometric) BIOMETRIC_WEAK else 0))
.build()
biometricPrompt.authenticate(promptInfo)
try {
val biometricPrompt = createBiometricPrompt(this)
val promptInfo = PromptInfo.Builder()
.setTitle(getString(R.string.prefs_biometriclock))
.setConfirmationRequired(true)
.setAllowedAuthenticators(DEVICE_CREDENTIAL or (if (withBiometric) BIOMETRIC_WEAK else 0))
.build()
biometricPrompt.authenticate(promptInfo)
} catch(e: Throwable) {
startActivity(Intent(this, MainActivityX::class.java))
}
}

private fun createBiometricPrompt(activity: Activity): BiometricPrompt {
Expand Down

0 comments on commit a54094d

Please sign in to comment.