From 50dec23b0238eb37ea116c23607e7f305c0df12d Mon Sep 17 00:00:00 2001 From: Mingshen Sun Date: Tue, 14 Apr 2020 11:55:18 -0700 Subject: [PATCH] Fix PGP key importing issue --- pass/Controllers/SettingsTableViewController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pass/Controllers/SettingsTableViewController.swift b/pass/Controllers/SettingsTableViewController.swift index 5440022..f9017b4 100644 --- a/pass/Controllers/SettingsTableViewController.swift +++ b/pass/Controllers/SettingsTableViewController.swift @@ -39,6 +39,8 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele DispatchQueue.global(qos: .userInitiated).async { [unowned self] in Defaults.pgpKeySource = type(of: keyImporter).keySource do { + // Remove exiting passphrase + AppKeychain.shared.removeAllContent(withPrefix: Globals.pgpKeyPassphrase) try keyImporter.importKeys() try PGPAgent.shared.initKeys() DispatchQueue.main.async { @@ -148,7 +150,9 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele }) if isReadyToUse() { - optionMenu.addAction(UIAlertAction(title: "\(Self.menuLabel) (\("Import".localize()))", style: .default)) + optionMenu.addAction(UIAlertAction(title: "\(Self.menuLabel) (\("Import".localize()))", style: .default) { _ in + self.saveImportedKeys() + }) } else { optionMenu.addAction(UIAlertAction(title: "\(Self.menuLabel) (\("Tips".localize()))", style: .default) { _ in let title = "Tips".localize()