Fix a bug about remembering pgp passphrase
- Do not keep the wrong passphrase
This commit is contained in:
parent
e1c6d9c0d8
commit
20f2e22076
2 changed files with 5 additions and 1 deletions
|
|
@ -147,6 +147,8 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
||||||
self.password = try self.passwordStore.decrypt(passwordEntity: self.passwordEntity!, requestPGPKeyPassphrase: self.requestPGPKeyPassphrase)
|
self.password = try self.passwordStore.decrypt(passwordEntity: self.passwordEntity!, requestPGPKeyPassphrase: self.requestPGPKeyPassphrase)
|
||||||
} catch {
|
} catch {
|
||||||
DispatchQueue.main.async {
|
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)
|
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
|
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(UIAlertAction) -> Void in
|
||||||
self.navigationController!.popViewController(animated: true)
|
self.navigationController!.popViewController(animated: true)
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
} catch {
|
} catch {
|
||||||
print(error)
|
print(error)
|
||||||
DispatchQueue.main.async {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue