prompt to re-enabled fp unlock after change master password
This commit is contained in:
		@@ -94,6 +94,7 @@
 | 
				
			|||||||
  <string name="fingerprint_unlock_hint">Touch sensor to unlock database</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_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_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">
 | 
					  <string name="enable_fingerprint_unlock_Info">
 | 
				
			||||||
    This will store your master password on this device,
 | 
					    This will store your master password on this device,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,7 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
using Android.Content;
 | 
					using Android.Content;
 | 
				
			||||||
using Android.OS;
 | 
					using Android.OS;
 | 
				
			||||||
 | 
					using Android.Preferences;
 | 
				
			||||||
using Android.Widget;
 | 
					using Android.Widget;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace keepass2android
 | 
					namespace keepass2android
 | 
				
			||||||
@@ -26,16 +27,11 @@ namespace keepass2android
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		internal String Keyfile;
 | 
							internal String Keyfile;
 | 
				
			||||||
		private readonly FileOnFinish _finish;
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public SetPasswordDialog(Context context):base(context) {
 | 
							public SetPasswordDialog(Context context):base(context) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public SetPasswordDialog(Context context, FileOnFinish finish):base(context) {
 | 
							
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			_finish = finish;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		protected override void OnCreate(Bundle savedInstanceState) 
 | 
							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);
 | 
									ProgressTask pt = new ProgressTask(App.Kp2a, Context, sp);
 | 
				
			||||||
				pt.Run();
 | 
									pt.Run();
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
@@ -82,9 +78,6 @@ namespace keepass2android
 | 
				
			|||||||
			Button cancelButton = (Button) FindViewById(Resource.Id.cancel);
 | 
								Button cancelButton = (Button) FindViewById(Resource.Id.cancel);
 | 
				
			||||||
			cancelButton.Click += (sender,e) => {
 | 
								cancelButton.Click += (sender,e) => {
 | 
				
			||||||
				Cancel();
 | 
									Cancel();
 | 
				
			||||||
				if ( _finish != null ) {
 | 
					 | 
				
			||||||
					_finish.Run();
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}; 
 | 
								}; 
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -106,6 +99,19 @@ namespace keepass2android
 | 
				
			|||||||
					if ( _finish != null ) {
 | 
										if ( _finish != null ) {
 | 
				
			||||||
						_finish.Filename = _dlg.Keyfile;
 | 
											_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();
 | 
										_dlg.Dismiss();
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user