Add essential checks before save edited password

This commit is contained in:
Bob Sun 2017-04-23 10:23:05 -07:00
parent ee077bf026
commit 594e7f4c53
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -23,8 +23,14 @@ class EditPasswordTableViewController: PasswordEditorTableViewController {
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
if identifier == "saveEditPasswordSegue" {
if let _ = tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? ContentTableViewCell {
// TODO: do some checks here
if let nameCell = tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? ContentTableViewCell {
if let name = nameCell.getContent(),
let _ = URL(string: name) {
return true
} else {
Utils.alert(title: "Cannot Save", message: "Password name is invalid.", controller: self, completion: nil)
return false
}
}
}
return true