Improve error messages when initializing fingerprint unlock fails. This is especially important for users who have migrated to a new device and previously received a very technical error message, but they simply need to reenable fingerprint on the new device. Fixes #37.

This commit is contained in:
Philipp Crocoll
2017-12-03 07:44:01 +01:00
parent d621ea15a3
commit da828523f3
3 changed files with 17 additions and 7 deletions

View File

@@ -1976,8 +1976,15 @@ namespace keepass2android
}
catch (Exception e)
{
//exception can happen here if the app was restored from Google Backup (including preferences) but no fingerprint data is there.
btn.SetImageResource(Resource.Drawable.ic_fingerprint_error);
btn.Tag = "Error initializing Fingerprint Unlock: " + e;
Kp2aLog.Log("failed to init fingerprint unlock:" + e.ToString());
string error = GetString(Resource.String.FingerprintInitFailed) + " " +
GetString(Resource.String.fingerprint_reenable2);
btn.Tag = error;
Toast.MakeText(this, Resource.String.fingerprint_reenable2, ToastLength.Long).Show();
_fingerprintDec = null;
return false;
@@ -1991,7 +1998,7 @@ namespace keepass2android
var btn = FindViewById<ImageButton>(Resource.Id.fingerprintbtn);
//key invalidated permanently
btn.SetImageResource(Resource.Drawable.ic_fingerprint_error);
btn.Tag = GetString(Resource.String.fingerprint_unlock_failed);
btn.Tag = GetString(Resource.String.fingerprint_unlock_failed) + " " + GetString(Resource.String.fingerprint_reenable2);
_fingerprintDec = null;
ClearFingerprintUnlockData();
@@ -2122,7 +2129,7 @@ namespace keepass2android
_act.ClearFingerprintUnlockData();
_act.InitFingerprintUnlock();
Message = _act.GetString(Resource.String.fingerprint_disabled_wrong_masterkey);
Message = _act.GetString(Resource.String.fingerprint_disabled_wrong_masterkey) + " " + _act.GetString(Resource.String.fingerprint_reenable2);
}
else
{

View File

@@ -305,8 +305,8 @@ namespace keepass2android
var btn = FindViewById<ImageButton>(Resource.Id.fingerprintbtn);
//key invalidated permanently
btn.SetImageResource(Resource.Drawable.ic_fingerprint_error);
btn.Tag = GetString(Resource.String.fingerprint_unlock_failed);
_fingerprintIdentifier = null;
btn.Tag = GetString(Resource.String.fingerprint_unlock_failed) + " " + GetString(Resource.String.fingerprint_reenable2);
_fingerprintIdentifier = null;
}
private void ClearFingerprintUnlockData()

View File

@@ -95,9 +95,12 @@
<string name="enable_fingerprint_unlock">Enable full Fingerprint Unlock</string>
<string name="enable_fingerprint_quickunlock">Enable Fingerprint Unlock for QuickUnlock</string>
<string name="fingerprint_unlock_hint">Touch sensor to unlock database</string>
<string name="fingerprint_unlock_failed">Fingerprint Unlock failed. Decryption key was invalidated by Android OS. This usually happens if a new fingerprint was enrolled or security settings were changed. Please unlock with your password and then re-enabled Fingerprint Unlock in the database settings.</string>
<string name="fingerprint_disabled_wrong_masterkey">Unlocking the database failed: Invalid composite key. Fingerprint Unlock was disabled because apparently the stored master password is no longer valid. Please unlock with your password and then re-enabled Fingerprint Unlock in the database settings.</string>
<string name="fingerprint_unlock_failed">Fingerprint Unlock failed. Decryption key was invalidated by Android OS. This usually happens if a new fingerprint was enrolled or security settings were changed. </string>
<string name="fingerprint_disabled_wrong_masterkey">Unlocking the database failed: Invalid composite key. Fingerprint Unlock was disabled because apparently the stored master password is no longer valid. </string>
<string name="fingerprint_reenable">Please re-enable Fingerprint Unlock for the new master password.</string>
<string name="fingerprint_reenable2">Please unlock with your password and then re-enable Fingerprint Unlock in the database settings.</string>
<string name="FingerprintInitFailed">Failed to initialize fingerprint sensor. </string>
<string name="enable_fingerprint_unlock_Info">This will store your master password on this device, encrypted with the Android Keystore and protected using fingerprint authentication. Allows to unlock your database only with your fingerprint.</string>
<string name="enable_fingerprint_quickunlock_Info">Allows to use fingerprint authentication instead of the QuickUnlock code. Does not store any information related to your master password.</string>