From 1690aff45e4515b10b21075428ddee58a6e3b40e Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Sat, 2 Jan 2016 22:22:55 +0100 Subject: [PATCH] prompt to re-enabled fp unlock after change master password --- .../Resources/values/strings.xml | 1 + src/keepass2android/SetPasswordDialog.cs | 26 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/keepass2android/Resources/values/strings.xml b/src/keepass2android/Resources/values/strings.xml index b04b3367..b6ab7735 100644 --- a/src/keepass2android/Resources/values/strings.xml +++ b/src/keepass2android/Resources/values/strings.xml @@ -94,6 +94,7 @@ Touch sensor to unlock database 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. 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. + Please re-enable Fingerprint Unlock for the new master password. This will store your master password on this device, diff --git a/src/keepass2android/SetPasswordDialog.cs b/src/keepass2android/SetPasswordDialog.cs index edcd2699..5ebaba3d 100644 --- a/src/keepass2android/SetPasswordDialog.cs +++ b/src/keepass2android/SetPasswordDialog.cs @@ -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 {