add checks to avoid invalid inputs
This commit is contained in:
parent
0b714ffec2
commit
3145ddacbe
4 changed files with 18 additions and 3 deletions
|
|
@ -26,7 +26,11 @@ class SettingsTableViewController: UITableViewController {
|
|||
@IBAction func save(segue: UIStoryboardSegue) {
|
||||
if let controller = segue.source as? PGPKeySettingTableViewController {
|
||||
|
||||
if Defaults[.pgpKeyID] == nil {
|
||||
if Defaults[.pgpKeyID] == nil ||
|
||||
Defaults[.pgpPrivateKeyURL] != URL(string: controller.pgpPrivateKeyURLTextField.text!) ||
|
||||
Defaults[.pgpPublicKeyURL] != URL(string: controller.pgpPublicKeyURLTextField.text!) ||
|
||||
Defaults[.pgpKeyPassphrase] != controller.pgpKeyPassphraseTextField.text!
|
||||
{
|
||||
Defaults[.pgpPrivateKeyURL] = URL(string: controller.pgpPrivateKeyURLTextField.text!)
|
||||
Defaults[.pgpPublicKeyURL] = URL(string: controller.pgpPublicKeyURLTextField.text!)
|
||||
Defaults[.pgpKeyPassphrase] = controller.pgpKeyPassphraseTextField.text!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue