add empty check for keychain credentials server (#19242)
This commit is contained in:
parent
3be1532b32
commit
6a88a34d34
|
@ -62,23 +62,26 @@
|
|||
([server username password]
|
||||
(save-credentials server username password identity))
|
||||
([server username password callback]
|
||||
(when-not (empty? server)
|
||||
(-> (.setInternetCredentials ^js react-native-keychain
|
||||
(string/lower-case server)
|
||||
username
|
||||
password
|
||||
keychain-secure-hardware
|
||||
keychain-restricted-availability)
|
||||
(.then callback))))
|
||||
(.then callback)))))
|
||||
|
||||
(defn get-credentials
|
||||
"Gets the credentials for a specified server from the Keychain"
|
||||
([server]
|
||||
(get-credentials server identity))
|
||||
([server callback]
|
||||
(when-not (empty? server)
|
||||
(-> (.getInternetCredentials ^js react-native-keychain (string/lower-case server))
|
||||
(.then callback))))
|
||||
(.then callback)))))
|
||||
|
||||
(defn reset-credentials
|
||||
[server]
|
||||
(when-not (empty? server)
|
||||
(-> (.resetInternetCredentials ^js react-native-keychain (string/lower-case server))
|
||||
(.then #(when-not % (log/error (str "Error while clearing saved password."))))))
|
||||
(.then #(when-not % (log/error (str "Error while clearing saved password.")))))))
|
||||
|
|
Loading…
Reference in New Issue