diff --git a/pass/Controllers/PasswordDetailTableViewController.swift b/pass/Controllers/PasswordDetailTableViewController.swift index 207e6cb..79e2742 100644 --- a/pass/Controllers/PasswordDetailTableViewController.swift +++ b/pass/Controllers/PasswordDetailTableViewController.swift @@ -147,6 +147,8 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni self.password = try self.passwordStore.decrypt(passwordEntity: self.passwordEntity!, requestPGPKeyPassphrase: self.requestPGPKeyPassphrase) } catch { DispatchQueue.main.async { + // remove the wrong passphrase so that users could enter it next time + self.passwordStore.pgpKeyPassphrase = nil let alert = UIAlertController(title: "Cannot Show Password", message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(UIAlertAction) -> Void in self.navigationController!.popViewController(animated: true) diff --git a/pass/Controllers/PasswordsViewController.swift b/pass/Controllers/PasswordsViewController.swift index 8dacbf1..3e284fe 100644 --- a/pass/Controllers/PasswordsViewController.swift +++ b/pass/Controllers/PasswordsViewController.swift @@ -386,7 +386,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV } catch { print(error) DispatchQueue.main.async { - Utils.alert(title: "Error", message: error.localizedDescription, controller: self, completion: nil) + // remove the wrong passphrase so that users could enter it next time + self.passwordStore.pgpKeyPassphrase = nil + Utils.alert(title: "Cannot Copy Password", message: error.localizedDescription, controller: self, completion: nil) } } }