Do not change keychain method on auth-bio fail
Do not change auth method if user does not save password Sanity check - fix only for biometric method Check for new auth method only when save password ScrollView Persist taps on login view Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
parent
f18e7d746b
commit
ff1022f337
|
@ -212,15 +212,12 @@
|
|||
(multiaccounts/switch-preview-privacy-mode-flag))))
|
||||
|
||||
(defn get-new-auth-method [auth-method save-password?]
|
||||
(if save-password?
|
||||
(when save-password?
|
||||
(when-not (or (= keychain/auth-method-biometric auth-method)
|
||||
(= keychain/auth-method-password auth-method))
|
||||
(if (= auth-method keychain/auth-method-biometric-prepare)
|
||||
keychain/auth-method-biometric
|
||||
keychain/auth-method-password))
|
||||
(when (and auth-method
|
||||
(not= auth-method keychain/auth-method-none))
|
||||
keychain/auth-method-none)))
|
||||
keychain/auth-method-password))))
|
||||
|
||||
(fx/defn login-only-events
|
||||
[{:keys [db] :as cofx} key-uid password save-password?]
|
||||
|
@ -393,7 +390,8 @@
|
|||
(fx/defn biometric-auth-done
|
||||
{:events [:biometric-auth-done]}
|
||||
[{:keys [db] :as cofx} {:keys [bioauth-success bioauth-message bioauth-code]}]
|
||||
(let [key-uid (get-in db [:multiaccounts/login :key-uid])]
|
||||
(let [key-uid (get-in db [:multiaccounts/login :key-uid])
|
||||
auth-method (get db :auth-method)]
|
||||
(log/debug "[biometric] biometric-auth-done"
|
||||
"bioauth-success" bioauth-success
|
||||
"bioauth-message" bioauth-message
|
||||
|
@ -401,9 +399,12 @@
|
|||
(if bioauth-success
|
||||
(get-credentials cofx key-uid)
|
||||
(fx/merge cofx
|
||||
{:db (assoc-in db [:multiaccounts/login :save-password?] false)}
|
||||
{:db (assoc-in db
|
||||
[:multiaccounts/login :save-password?]
|
||||
(= auth-method keychain/auth-method-biometric))}
|
||||
(when-not (= auth-method keychain/auth-method-biometric)
|
||||
(keychain/save-auth-method key-uid keychain/auth-method-none))
|
||||
(biometric/show-message bioauth-message bioauth-code)
|
||||
(keychain/save-auth-method key-uid keychain/auth-method-none)
|
||||
(open-login-callback nil)))))
|
||||
|
||||
(fx/defn save-password
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
supported-biometric-auth [:supported-biometric-auth]]
|
||||
[react/keyboard-avoiding-view {:style ast/multiaccounts-view}
|
||||
[login-toolbar can-navigate-back?]
|
||||
[react/scroll-view styles/login-view
|
||||
[react/scroll-view {:keyboardShouldPersistTaps :always
|
||||
:style styles/login-view}
|
||||
[react/view styles/login-badge-container
|
||||
[multiaccount-login-badge multiaccount]
|
||||
[react/view {:style styles/password-container
|
||||
|
@ -72,7 +73,7 @@
|
|||
(re-frame/dispatch [:set-in [:multiaccounts/login :password]
|
||||
(security/mask-data %)])
|
||||
(re-frame/dispatch [:set-in [:multiaccounts/login :error] ""]))
|
||||
:secure-text-entry true
|
||||
:secure-text-entry true
|
||||
:error (when (not-empty error) error)}]]
|
||||
(when (and supported-biometric-auth (= auth-method "biometric"))
|
||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:biometric-authenticate])}
|
||||
|
@ -106,9 +107,9 @@
|
|||
(react/dismiss-keyboard!)
|
||||
(re-frame/dispatch [:multiaccounts.recover.ui/recover-multiaccount-button-pressed]))}]
|
||||
[components.common/button
|
||||
{:label (i18n/label :t/submit)
|
||||
{:label (i18n/label :t/submit)
|
||||
:button-style styles/bottom-button
|
||||
:label-style {:color (if (or (not sign-in-enabled?) processing) colors/gray colors/blue)}
|
||||
:background? true
|
||||
:disabled? (or (not sign-in-enabled?) processing)
|
||||
:on-press #(login-multiaccount @password-text-input)}]]]))
|
||||
:label-style {:color (if (or (not sign-in-enabled?) processing) colors/gray colors/blue)}
|
||||
:background? true
|
||||
:disabled? (or (not sign-in-enabled?) processing)
|
||||
:on-press #(login-multiaccount @password-text-input)}]]]))
|
||||
|
|
Loading…
Reference in New Issue