prompt to re-enabled fp unlock after change master password

This commit is contained in:
Philipp Crocoll 2016-01-02 22:22:55 +01:00
parent aed1d88f75
commit 1690aff45e
2 changed files with 17 additions and 10 deletions

View File

@ -94,6 +94,7 @@
<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_reenable">Please re-enable Fingerprint Unlock for the new master password.</string>
<string name="enable_fingerprint_unlock_Info">
This will store your master password on this device,

View File

@ -17,6 +17,7 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
using System;
using Android.Content;
using Android.OS;
using Android.Preferences;
using Android.Widget;
namespace keepass2android
@ -26,16 +27,11 @@ namespace keepass2android
{
internal String Keyfile;
private readonly FileOnFinish _finish;
public SetPasswordDialog(Context context):base(context) {
}
public SetPasswordDialog(Context context, FileOnFinish finish):base(context) {
_finish = finish;
}
protected override void OnCreate(Bundle savedInstanceState)
{
@ -71,7 +67,7 @@ namespace keepass2android
}
SetPassword sp = new SetPassword(Context, App.Kp2a, pass, keyfile, new AfterSave(this, _finish, new Handler()));
SetPassword sp = new SetPassword(Context, App.Kp2a, pass, keyfile, new AfterSave(this, null, new Handler()));
ProgressTask pt = new ProgressTask(App.Kp2a, Context, sp);
pt.Run();
};
@ -82,9 +78,6 @@ namespace keepass2android
Button cancelButton = (Button) FindViewById(Resource.Id.cancel);
cancelButton.Click += (sender,e) => {
Cancel();
if ( _finish != null ) {
_finish.Run();
}
};
}
@ -106,6 +99,19 @@ namespace keepass2android
if ( _finish != null ) {
_finish.Filename = _dlg.Keyfile;
}
FingerprintUnlockMode um;
Enum.TryParse(PreferenceManager.GetDefaultSharedPreferences(_dlg.Context).GetString(App.Kp2a.GetDb().CurrentFingerprintModePrefKey, ""), out um);
if (um == FingerprintUnlockMode.FullUnlock)
{
ISharedPreferencesEditor edit = PreferenceManager.GetDefaultSharedPreferences(_dlg.Context).Edit();
edit.PutString(App.Kp2a.GetDb().CurrentFingerprintPrefKey, "");
edit.PutString(App.Kp2a.GetDb().CurrentFingerprintModePrefKey, FingerprintUnlockMode.Disabled.ToString());
edit.Commit();
Toast.MakeText(_dlg.Context, Resource.String.fingerprint_reenable, ToastLength.Long).Show();
_dlg.Context.StartActivity(typeof(FingerprintSetupActivity));
}
_dlg.Dismiss();
} else {