Remove password inside try/catch

This commit is contained in:
Davide De Rosa 2020-12-18 13:40:53 +01:00
parent ecb2c951a8
commit 4a5bc92fcb
1 changed files with 1 additions and 2 deletions

View File

@ -103,6 +103,7 @@ public class Keychain {
guard password != currentPassword else {
return
}
removePassword(for: username)
} catch let e as KeychainError {
// rethrow cancelation
@ -113,8 +114,6 @@ public class Keychain {
// otherwise, no pre-existing password
}
removePassword(for: username)
var query = [String: Any]()
setScope(query: &query)
query[kSecClass as String] = kSecClassGenericPassword