check pgpKey before decrypting password
This commit is contained in:
parent
9f4830dc2a
commit
a2fb5b4a2c
1 changed files with 7 additions and 1 deletions
|
|
@ -177,6 +177,12 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyToPasteboard(from indexPath: IndexPath) {
|
func copyToPasteboard(from indexPath: IndexPath) {
|
||||||
|
if Defaults[.pgpKeyID] == nil {
|
||||||
|
let alert = UIAlertController(title: "Cannot Copy Password", message: "PGP Key is not set. Please set your PGP Key first.", preferredStyle: UIAlertControllerStyle.alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
||||||
|
self.present(alert, animated: true, completion: nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
let index = sections[indexPath.section].index + indexPath.row
|
let index = sections[indexPath.section].index + indexPath.row
|
||||||
let password: PasswordEntity
|
let password: PasswordEntity
|
||||||
if searchController.isActive && searchController.searchBar.text != "" {
|
if searchController.isActive && searchController.searchBar.text != "" {
|
||||||
|
|
@ -253,7 +259,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
|
|
||||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||||
if identifier == "showPasswordDetail" {
|
if identifier == "showPasswordDetail" {
|
||||||
if Defaults[.pgpKeyID] == "" {
|
if Defaults[.pgpKeyID] == nil {
|
||||||
let alert = UIAlertController(title: "Cannot Show Password", message: "PGP Key is not set. Please set your PGP Key first.", preferredStyle: UIAlertControllerStyle.alert)
|
let alert = UIAlertController(title: "Cannot Show Password", message: "PGP Key is not set. Please set your PGP Key first.", preferredStyle: UIAlertControllerStyle.alert)
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
||||||
self.present(alert, animated: true, completion: nil)
|
self.present(alert, animated: true, completion: nil)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue