Show proper error when bio metric fails (#20233)

This commit is contained in:
Parvesh Monu 2024-05-31 13:13:00 +05:30 committed by GitHub
parent 86bbe2e8c7
commit 4ff73a8a6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 5 deletions

View File

@ -8,6 +8,8 @@
(def ^:private ^:const android-not-available-error-message "Biometric hardware unavailable") (def ^:private ^:const android-not-available-error-message "Biometric hardware unavailable")
(def ^:private ^:const android-not-enrolled-error-message "No fingerprints enrolled.") (def ^:private ^:const android-not-enrolled-error-message "No fingerprints enrolled.")
(def ^:private ^:const android-too-many-attempts-error-message
"Too many attempts. Use screen lock instead.")
(def ^:private ^:const ios-not-enrolled-error-message "No identities are enrolled") (def ^:private ^:const ios-not-enrolled-error-message "No identities are enrolled")
(defn get-supported-type (defn get-supported-type
@ -41,6 +43,7 @@
(condp = message (condp = message
android-not-enrolled-error-message :biometrics/not-enrolled-error android-not-enrolled-error-message :biometrics/not-enrolled-error
android-not-available-error-message :biometrics/not-available-error android-not-available-error-message :biometrics/not-available-error
android-too-many-attempts-error-message :biometric/too-many-attempts
:biometrics/unknown-error) :biometrics/unknown-error)
(condp #(string/includes? %2 %1) message (condp #(string/includes? %2 %1) message

View File

@ -13,10 +13,14 @@
(defn show-message (defn show-message
[_ [code]] [_ [code]]
(let [content (if (#{:biometrics/not-enrolled-error (let [content (case code
:biometrics/not-available-error} (:biometrics/not-enrolled-error
code) :biometrics/not-available-error)
(i18n/label :t/grant-face-id-permissions) (i18n/label :t/grant-face-id-permissions)
:biometric/too-many-attempts
(i18n/label :t/biometric-too-many-attempts)
(i18n/label :t/biometric-auth-error {:code code}))] (i18n/label :t/biometric-auth-error {:code code}))]
{:fx [[:effects.utils/show-popup {:fx [[:effects.utils/show-popup
{:title (i18n/label :t/biometric-auth-login-error-title) {:title (i18n/label :t/biometric-auth-login-error-title)

View File

@ -91,6 +91,7 @@
"biometric-enable-button": "Enable {{bio-type-label}}", "biometric-enable-button": "Enable {{bio-type-label}}",
"biometric-fingerprint": "Fingerprint", "biometric-fingerprint": "Fingerprint",
"biometric-faceid": "Face ID", "biometric-faceid": "Face ID",
"biometric-too-many-attempts": "Too many attempts. Enter the password manually or try again after some time",
"biometric-touchid": "Touch ID", "biometric-touchid": "Touch ID",
"blank-keycard-text": "You can proceed with your keycard once you've generated your keys and name", "blank-keycard-text": "You can proceed with your keycard once you've generated your keys and name",
"blank-keycard-title": "Looks like youve tapped \na blank keycard", "blank-keycard-title": "Looks like youve tapped \na blank keycard",