use keychain to store pgp passphrase and git password

This commit is contained in:
Bob Sun 2017-02-19 22:10:36 +08:00
parent ceb52a5b33
commit 90709675a3
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
10 changed files with 86 additions and 19 deletions

View file

@ -43,14 +43,14 @@ class PasswordRepositorySettingsTableViewController: BasicStaticTableViewControl
if let controller = segue.source as? GitServerSettingTableViewController {
let gitRepostiroyURL = controller.gitRepositoryURLTextField.text!
let username = controller.usernameTextField.text!
let password = Defaults[.gitRepositoryPassword]
let password = controller.password
let auth = controller.authenticationMethod
if Defaults[.gitRepositoryURL] == nil ||
Defaults[.gitRepositoryURL]!.absoluteString != gitRepostiroyURL ||
auth != Defaults[.gitRepositoryAuthenticationMethod] ||
username != Defaults[.gitRepositoryUsername] ||
password != Defaults[.gitRepositoryPassword] {
password != PasswordStore.shared.gitRepositoryPassword {
SVProgressHUD.setDefaultMaskType(.black)
SVProgressHUD.setDefaultStyle(.light)
@ -82,7 +82,7 @@ class PasswordRepositorySettingsTableViewController: BasicStaticTableViewControl
NotificationCenter.default.post(Notification(name: Notification.Name("passwordUpdated")))
Defaults[.gitRepositoryURL] = URL(string: gitRepostiroyURL)
Defaults[.gitRepositoryUsername] = username
Defaults[.gitRepositoryPassword] = password
PasswordStore.shared.gitRepositoryPassword = password
Defaults[.gitRepositoryAuthenticationMethod] = auth
Defaults[.gitRepositoryPasswordAttempts] = 0
SVProgressHUD.showSuccess(withStatus: "Done")