public async void Accept(Object parameter) { App.AppLogger.Logger.Log(devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | devoctomy.DFramework.Logging.Interfaces.LoggerMessageType.Information, "Accept command invoked."); PasswordEntryView passwordEntry = View.FindByName <PasswordEntryView>("PasswordEntry"); if (passwordEntry != null) { switch (passwordEntry.StrengthCheck) { case PasswordEntryView.StrengthCheckResult.InWeakDictionary: { bool?agree = await App.Controller.MainPageInstance.DisplayAlert("Security Alert", "The current password has been found in the internal known weak password database. You are advised to enter another password or use the 'Password Generator'.", "OK", "No, I understand the risk"); if (agree.HasValue && agree.Value) { return; } break; } case PasswordEntryView.StrengthCheckResult.FailComplexityCheck: { bool?agree = await App.Controller.MainPageInstance.DisplayAlert("Security Alert", "The current password has failed the complexity test. You are advised to enter another password or use the 'Password Generator'.", "OK", "No, I understand the risk"); if (agree.HasValue && agree.Value) { return; } break; } case PasswordEntryView.StrengthCheckResult.OK: { bool duplicate = false; switch (_mode) { case EditorMode.Create: { duplicate = Credential.Vault.Credentials.Any(cred => cred.Password == Credential.Password); break; } case EditorMode.Edit: { duplicate = Credential.Vault.Credentials.Where(cred => cred.ID != Credential.ID).Any(cred => cred.Password == Credential.Password); break; } } if (duplicate) { bool?agree = await App.Controller.MainPageInstance.DisplayAlert("Security Alert", "The current password is already in use by another credential in your vault. You are advised to enter another password or use the 'Password Generator'.", "OK", "No, I understand the risk"); if (agree.HasValue && agree.Value) { return; } } //Check vault for duplicate usage break; } } } //Add the credential to the vault that it was created for switch (_mode) { case EditorMode.Create: { //This is a temporary fix for now as when typing into the tag //it can create a whole bunch of additional tags erroneously TagEditor tagEditor = View.FindByName <TagEditor>("CredentialTags"); if (tagEditor != null) { tagEditor.Recreate(); } Credential.AddToVault(true); if (AppConfig.Instance.AutoSave && AppConfig.Instance.AutoSaveOnDuplicatingCred) { Common.SaveResult saveResult = await Save(); if (saveResult == Common.SaveResult.Success) { VaultIndexFile.Invalidate(); } } App.Controller.NavigateTo("vault", new KeyValuePair <String, Object>("Vault", Credential.Vault)); break; } case EditorMode.Edit: { //This is a temporary fix for now as when typing into the tag //it can create a whole bunch of additional tags erroneously TagEditor tagEditor = View.FindByName <TagEditor>("CredentialTags"); if (tagEditor != null) { tagEditor.Recreate(); } Credential originalCredential = Credential.Vault.Credentials.Where(cred => cred.ID == Credential.ID).First(); Credential.CopyTo(originalCredential); if (AppConfig.Instance.AutoSave && AppConfig.Instance.AutoSaveOnDuplicatingCred) { Common.SaveResult saveResult = await Save(); if (saveResult == Common.SaveResult.Success) { VaultIndexFile.Invalidate(); } } App.Controller.NavigateTo("vault", new KeyValuePair <String, Object>("Vault", Credential.Vault)); break; } } }