mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-12 09:44:13 +00:00
Add biometric auth if available to communities password input (#19336)
This commit is contained in:
parent
68402ae669
commit
7e896979f6
@ -3,7 +3,8 @@
|
||||
[promesa.core :as promesa]
|
||||
[schema.core :as schema]
|
||||
[status-im.common.json-rpc.events :as rpc]
|
||||
[utils.re-frame :as rf]))
|
||||
[utils.re-frame :as rf]
|
||||
[utils.security.core :as security]))
|
||||
|
||||
(defn- generate-requests-for-signing
|
||||
[pub-key community-id addresses-to-reveal]
|
||||
@ -21,7 +22,7 @@
|
||||
(fn [p-resolve p-reject]
|
||||
(rpc/call
|
||||
{:method :wakuext_signData
|
||||
:params [(map #(assoc % :password password) sign-params)]
|
||||
:params [(map #(assoc % :password (security/safe-unmask-data password)) sign-params)]
|
||||
:on-success p-resolve
|
||||
:on-error #(p-reject (str "failed to sign data\n" %))}))))
|
||||
|
||||
@ -80,7 +81,7 @@
|
||||
[:cat
|
||||
[:map {:closed true}
|
||||
[:community-id string?]
|
||||
[:password string?]
|
||||
[:password [:maybe [:or string? object?]]]
|
||||
[:pub-key string?]
|
||||
[:addresses-to-reveal
|
||||
[:or [:set string?]
|
||||
|
@ -3,7 +3,6 @@
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[status-im.common.password-authentication.view :as password-authentication]
|
||||
[status-im.contexts.communities.actions.accounts-selection.style :as style]
|
||||
[status-im.contexts.communities.actions.addresses-for-permissions.view :as addresses-for-permissions]
|
||||
[status-im.contexts.communities.actions.airdrop-addresses.view :as airdrop-addresses]
|
||||
@ -58,12 +57,15 @@
|
||||
(rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch
|
||||
[:password-authentication/show
|
||||
{:content (fn [] [password-authentication/view])}
|
||||
{:label (i18n/label :t/join-open-community)
|
||||
:on-press (fn [password]
|
||||
(rf/dispatch [:communities/request-to-join-with-addresses
|
||||
{:community-id id :password password}]))}])
|
||||
[:standard-auth/authorize
|
||||
{:auth-button-label (if can-edit-addresses?
|
||||
(i18n/label :t/edit-shared-addresses)
|
||||
(i18n/label :t/request-to-join))
|
||||
:on-auth-success (fn [password]
|
||||
(rf/dispatch
|
||||
[:communities/request-to-join-with-addresses
|
||||
{:community-id id
|
||||
:password password}]))}])
|
||||
(navigate-back)))
|
||||
|
||||
open-permission-sheet
|
||||
|
@ -4,7 +4,6 @@
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[status-im.common.password-authentication.view :as password-authentication]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.communities.actions.addresses-for-permissions.style :as style]
|
||||
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
|
||||
@ -222,22 +221,22 @@
|
||||
confirm-changes
|
||||
(fn []
|
||||
(if can-edit-addresses?
|
||||
(rf/dispatch
|
||||
[:password-authentication/show
|
||||
{:content (fn [] [password-authentication/view])}
|
||||
{:label (i18n/label :t/enter-password)
|
||||
:on-press (fn [password]
|
||||
(rf/dispatch
|
||||
[:communities/edit-shared-addresses
|
||||
{:community-id id
|
||||
:password password
|
||||
:addresses addresses-to-reveal
|
||||
:on-success (fn []
|
||||
(rf/dispatch [:dismiss-modal :addresses-for-permissions])
|
||||
(rf/dispatch [:hide-bottom-sheet]))}]))}])
|
||||
(do
|
||||
(rf/dispatch [:communities/set-share-all-addresses id flag-share-all-addresses])
|
||||
(rf/dispatch [:communities/set-addresses-to-reveal id addresses-to-reveal]))))
|
||||
(rf/dispatch
|
||||
[:standard-auth/authorize
|
||||
{:auth-button-label (i18n/label :t/confirm-changes)
|
||||
:on-auth-success (fn [password]
|
||||
(rf/dispatch
|
||||
[:communities/edit-shared-addresses
|
||||
{:community-id id
|
||||
:password password
|
||||
:addresses addresses-to-reveal
|
||||
:on-success (fn []
|
||||
(rf/dispatch [:dismiss-modal
|
||||
:addresses-for-permissions])
|
||||
(rf/dispatch [:hide-bottom-sheet]))}]))}])
|
||||
(rf/dispatch [:communities/set-share-all-addresses id flag-share-all-addresses]))
|
||||
(rf/dispatch [:communities/set-addresses-to-reveal id addresses-to-reveal])))
|
||||
pending? (rf/sub [:communities/has-pending-request-to-join? id])
|
||||
highest-role (rf/sub [:communities/highest-role-for-selection id])
|
||||
[unmodified-role _] (rn/use-state highest-role)]
|
||||
|
@ -4,7 +4,6 @@
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[status-im.common.not-implemented :as not-implemented]
|
||||
[status-im.common.password-authentication.view :as password-authentication]
|
||||
[status-im.contexts.communities.actions.airdrop-addresses.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
@ -19,18 +18,20 @@
|
||||
(fn []
|
||||
(if can-edit-addresses?
|
||||
(rf/dispatch
|
||||
[:password-authentication/show
|
||||
{:content (fn [] [password-authentication/view])}
|
||||
{:label (i18n/label :t/enter-password)
|
||||
:on-press (fn [password]
|
||||
(rf/dispatch
|
||||
[:communities/edit-shared-addresses
|
||||
{:community-id community-id
|
||||
:password password
|
||||
:airdrop-address address
|
||||
:on-success (fn []
|
||||
(rf/dispatch [:dismiss-modal :address-for-airdrop])
|
||||
(rf/dispatch [:hide-bottom-sheet]))}]))}])
|
||||
[:standard-auth/authorize
|
||||
{:auth-button-label (i18n/label :t/confirm-changes)
|
||||
:on-auth-success (fn [password]
|
||||
(rf/dispatch
|
||||
[:communities/edit-shared-addresses
|
||||
{:community-id community-id
|
||||
:password password
|
||||
:airdrop-address address
|
||||
:on-success (fn []
|
||||
(rf/dispatch
|
||||
[:dismiss-modal
|
||||
:address-for-airdrop])
|
||||
(rf/dispatch
|
||||
[:hide-bottom-sheet]))}]))}])
|
||||
(do
|
||||
(rf/dispatch [:communities/set-airdrop-address community-id address])
|
||||
(rf/dispatch [:hide-bottom-sheet])))))]
|
||||
|
@ -5,7 +5,6 @@
|
||||
[quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[status-im.common.password-authentication.view :as password-authentication]
|
||||
[status-im.contexts.communities.actions.community-rules-list.view :as community-rules]
|
||||
[status-im.contexts.communities.actions.request-to-join.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
@ -13,11 +12,14 @@
|
||||
|
||||
(defn join-community-and-navigate-back
|
||||
[id]
|
||||
(rf/dispatch [:password-authentication/show
|
||||
{:content (fn [] [password-authentication/view])}
|
||||
{:label (i18n/label :t/join-open-community)
|
||||
:on-press #(rf/dispatch [:communities/request-to-join
|
||||
{:community-id id :password %}])}])
|
||||
(rf/dispatch
|
||||
[:standard-auth/authorize
|
||||
{:auth-button-label (i18n/label :t/request-to-join)
|
||||
:on-auth-success (fn [password]
|
||||
(rf/dispatch
|
||||
[:communities/request-to-join
|
||||
{:community-id id :password password}]))}])
|
||||
|
||||
(rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn- view-internal
|
||||
|
@ -3,7 +3,8 @@
|
||||
[status-im.contexts.communities.utils :as utils]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
[utils.re-frame :as rf]
|
||||
[utils.security.core :as security]))
|
||||
|
||||
(rf/reg-event-fx :communities/check-permissions-to-join-community-success
|
||||
(fn [{:keys [db]} [community-id based-on-client-selection? result]]
|
||||
@ -89,7 +90,7 @@
|
||||
(let [addresses-to-reveal (map :account sign-params)]
|
||||
{:fx [[:json-rpc/call
|
||||
[{:method "wakuext_signData"
|
||||
:params [(map #(assoc % :password password) sign-params)]
|
||||
:params [(map #(assoc % :password (security/safe-unmask-data password)) sign-params)]
|
||||
:on-success [:communities/request-to-join-with-signatures community-id addresses-to-reveal]
|
||||
:on-error [:communities/requested-to-join-error community-id]}]]]}))
|
||||
|
||||
|
@ -420,8 +420,7 @@ class CommunityView(HomeView):
|
||||
self.join_button.wait_and_click(120)
|
||||
self.slide_to_request_to_join_button.swipe_right_on_element(width_percentage=16)
|
||||
self.password_input.send_keys(password)
|
||||
Button(self.driver,
|
||||
xpath="//*[@content-desc='password-input']/../following-sibling::*//*[@text='Join Community']").click()
|
||||
self.login_button.click()
|
||||
if open_community:
|
||||
self.community_status_joined.wait_for_visibility_of_element(60)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user