mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 11:34:45 +00:00
add empty check for keychain credentials server (#19242)
This commit is contained in:
parent
3be1532b32
commit
6a88a34d34
@ -62,23 +62,26 @@
|
|||||||
([server username password]
|
([server username password]
|
||||||
(save-credentials server username password identity))
|
(save-credentials server username password identity))
|
||||||
([server username password callback]
|
([server username password callback]
|
||||||
|
(when-not (empty? server)
|
||||||
(-> (.setInternetCredentials ^js react-native-keychain
|
(-> (.setInternetCredentials ^js react-native-keychain
|
||||||
(string/lower-case server)
|
(string/lower-case server)
|
||||||
username
|
username
|
||||||
password
|
password
|
||||||
keychain-secure-hardware
|
keychain-secure-hardware
|
||||||
keychain-restricted-availability)
|
keychain-restricted-availability)
|
||||||
(.then callback))))
|
(.then callback)))))
|
||||||
|
|
||||||
(defn get-credentials
|
(defn get-credentials
|
||||||
"Gets the credentials for a specified server from the Keychain"
|
"Gets the credentials for a specified server from the Keychain"
|
||||||
([server]
|
([server]
|
||||||
(get-credentials server identity))
|
(get-credentials server identity))
|
||||||
([server callback]
|
([server callback]
|
||||||
|
(when-not (empty? server)
|
||||||
(-> (.getInternetCredentials ^js react-native-keychain (string/lower-case server))
|
(-> (.getInternetCredentials ^js react-native-keychain (string/lower-case server))
|
||||||
(.then callback))))
|
(.then callback)))))
|
||||||
|
|
||||||
(defn reset-credentials
|
(defn reset-credentials
|
||||||
[server]
|
[server]
|
||||||
|
(when-not (empty? server)
|
||||||
(-> (.resetInternetCredentials ^js react-native-keychain (string/lower-case 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…
x
Reference in New Issue
Block a user