Skip to content

Commit 7e89697

Browse files
authored
Add biometric auth if available to communities password input (#19336)
1 parent 68402ae commit 7e89697

File tree

7 files changed

+54
-49
lines changed

7 files changed

+54
-49
lines changed

src/status_im/contexts/communities/actions/accounts_selection/effects.cljs

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[promesa.core :as promesa]
44
[schema.core :as schema]
55
[status-im.common.json-rpc.events :as rpc]
6-
[utils.re-frame :as rf]))
6+
[utils.re-frame :as rf]
7+
[utils.security.core :as security]))
78

89
(defn- generate-requests-for-signing
910
[pub-key community-id addresses-to-reveal]
@@ -21,7 +22,7 @@
2122
(fn [p-resolve p-reject]
2223
(rpc/call
2324
{:method :wakuext_signData
24-
:params [(map #(assoc % :password password) sign-params)]
25+
:params [(map #(assoc % :password (security/safe-unmask-data password)) sign-params)]
2526
:on-success p-resolve
2627
:on-error #(p-reject (str "failed to sign data\n" %))}))))
2728

@@ -80,7 +81,7 @@
8081
[:cat
8182
[:map {:closed true}
8283
[:community-id string?]
83-
[:password string?]
84+
[:password [:maybe [:or string? object?]]]
8485
[:pub-key string?]
8586
[:addresses-to-reveal
8687
[:or [:set string?]

src/status_im/contexts/communities/actions/accounts_selection/view.cljs

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[quo.core :as quo]
44
[react-native.core :as rn]
55
[react-native.gesture :as gesture]
6-
[status-im.common.password-authentication.view :as password-authentication]
76
[status-im.contexts.communities.actions.accounts-selection.style :as style]
87
[status-im.contexts.communities.actions.addresses-for-permissions.view :as addresses-for-permissions]
98
[status-im.contexts.communities.actions.airdrop-addresses.view :as airdrop-addresses]
@@ -58,12 +57,15 @@
5857
(rn/use-callback
5958
(fn []
6059
(rf/dispatch
61-
[:password-authentication/show
62-
{:content (fn [] [password-authentication/view])}
63-
{:label (i18n/label :t/join-open-community)
64-
:on-press (fn [password]
65-
(rf/dispatch [:communities/request-to-join-with-addresses
66-
{:community-id id :password password}]))}])
60+
[:standard-auth/authorize
61+
{:auth-button-label (if can-edit-addresses?
62+
(i18n/label :t/edit-shared-addresses)
63+
(i18n/label :t/request-to-join))
64+
:on-auth-success (fn [password]
65+
(rf/dispatch
66+
[:communities/request-to-join-with-addresses
67+
{:community-id id
68+
:password password}]))}])
6769
(navigate-back)))
6870

6971
open-permission-sheet

src/status_im/contexts/communities/actions/addresses_for_permissions/view.cljs

+15-16
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[quo.core :as quo]
55
[react-native.core :as rn]
66
[react-native.gesture :as gesture]
7-
[status-im.common.password-authentication.view :as password-authentication]
87
[status-im.constants :as constants]
98
[status-im.contexts.communities.actions.addresses-for-permissions.style :as style]
109
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
@@ -222,22 +221,22 @@
222221
confirm-changes
223222
(fn []
224223
(if can-edit-addresses?
225-
(rf/dispatch
226-
[:password-authentication/show
227-
{:content (fn [] [password-authentication/view])}
228-
{:label (i18n/label :t/enter-password)
229-
:on-press (fn [password]
230-
(rf/dispatch
231-
[:communities/edit-shared-addresses
232-
{:community-id id
233-
:password password
234-
:addresses addresses-to-reveal
235-
:on-success (fn []
236-
(rf/dispatch [:dismiss-modal :addresses-for-permissions])
237-
(rf/dispatch [:hide-bottom-sheet]))}]))}])
238224
(do
239-
(rf/dispatch [:communities/set-share-all-addresses id flag-share-all-addresses])
240-
(rf/dispatch [:communities/set-addresses-to-reveal id addresses-to-reveal]))))
225+
(rf/dispatch
226+
[:standard-auth/authorize
227+
{:auth-button-label (i18n/label :t/confirm-changes)
228+
:on-auth-success (fn [password]
229+
(rf/dispatch
230+
[:communities/edit-shared-addresses
231+
{:community-id id
232+
:password password
233+
:addresses addresses-to-reveal
234+
:on-success (fn []
235+
(rf/dispatch [:dismiss-modal
236+
:addresses-for-permissions])
237+
(rf/dispatch [:hide-bottom-sheet]))}]))}])
238+
(rf/dispatch [:communities/set-share-all-addresses id flag-share-all-addresses]))
239+
(rf/dispatch [:communities/set-addresses-to-reveal id addresses-to-reveal])))
241240
pending? (rf/sub [:communities/has-pending-request-to-join? id])
242241
highest-role (rf/sub [:communities/highest-role-for-selection id])
243242
[unmodified-role _] (rn/use-state highest-role)]

src/status_im/contexts/communities/actions/airdrop_addresses/view.cljs

+14-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[react-native.core :as rn]
55
[react-native.gesture :as gesture]
66
[status-im.common.not-implemented :as not-implemented]
7-
[status-im.common.password-authentication.view :as password-authentication]
87
[status-im.contexts.communities.actions.airdrop-addresses.style :as style]
98
[utils.i18n :as i18n]
109
[utils.re-frame :as rf]))
@@ -19,18 +18,20 @@
1918
(fn []
2019
(if can-edit-addresses?
2120
(rf/dispatch
22-
[:password-authentication/show
23-
{:content (fn [] [password-authentication/view])}
24-
{:label (i18n/label :t/enter-password)
25-
:on-press (fn [password]
26-
(rf/dispatch
27-
[:communities/edit-shared-addresses
28-
{:community-id community-id
29-
:password password
30-
:airdrop-address address
31-
:on-success (fn []
32-
(rf/dispatch [:dismiss-modal :address-for-airdrop])
33-
(rf/dispatch [:hide-bottom-sheet]))}]))}])
21+
[:standard-auth/authorize
22+
{:auth-button-label (i18n/label :t/confirm-changes)
23+
:on-auth-success (fn [password]
24+
(rf/dispatch
25+
[:communities/edit-shared-addresses
26+
{:community-id community-id
27+
:password password
28+
:airdrop-address address
29+
:on-success (fn []
30+
(rf/dispatch
31+
[:dismiss-modal
32+
:address-for-airdrop])
33+
(rf/dispatch
34+
[:hide-bottom-sheet]))}]))}])
3435
(do
3536
(rf/dispatch [:communities/set-airdrop-address community-id address])
3637
(rf/dispatch [:hide-bottom-sheet])))))]

src/status_im/contexts/communities/actions/request_to_join/view.cljs

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@
55
[quo.theme]
66
[react-native.core :as rn]
77
[react-native.gesture :as gesture]
8-
[status-im.common.password-authentication.view :as password-authentication]
98
[status-im.contexts.communities.actions.community-rules-list.view :as community-rules]
109
[status-im.contexts.communities.actions.request-to-join.style :as style]
1110
[utils.i18n :as i18n]
1211
[utils.re-frame :as rf]))
1312

1413
(defn join-community-and-navigate-back
1514
[id]
16-
(rf/dispatch [:password-authentication/show
17-
{:content (fn [] [password-authentication/view])}
18-
{:label (i18n/label :t/join-open-community)
19-
:on-press #(rf/dispatch [:communities/request-to-join
20-
{:community-id id :password %}])}])
15+
(rf/dispatch
16+
[:standard-auth/authorize
17+
{:auth-button-label (i18n/label :t/request-to-join)
18+
:on-auth-success (fn [password]
19+
(rf/dispatch
20+
[:communities/request-to-join
21+
{:community-id id :password password}]))}])
22+
2123
(rf/dispatch [:navigate-back]))
2224

2325
(defn- view-internal

src/status_im/contexts/communities/overview/events.cljs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[status-im.contexts.communities.utils :as utils]
44
[taoensso.timbre :as log]
55
[utils.i18n :as i18n]
6-
[utils.re-frame :as rf]))
6+
[utils.re-frame :as rf]
7+
[utils.security.core :as security]))
78

89
(rf/reg-event-fx :communities/check-permissions-to-join-community-success
910
(fn [{:keys [db]} [community-id based-on-client-selection? result]]
@@ -89,7 +90,7 @@
8990
(let [addresses-to-reveal (map :account sign-params)]
9091
{:fx [[:json-rpc/call
9192
[{:method "wakuext_signData"
92-
:params [(map #(assoc % :password password) sign-params)]
93+
:params [(map #(assoc % :password (security/safe-unmask-data password)) sign-params)]
9394
:on-success [:communities/request-to-join-with-signatures community-id addresses-to-reveal]
9495
:on-error [:communities/requested-to-join-error community-id]}]]]}))
9596

test/appium/views/chat_view.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,7 @@ def join_community(self, password=common_password, open_community=True):
420420
self.join_button.wait_and_click(120)
421421
self.slide_to_request_to_join_button.swipe_right_on_element(width_percentage=16)
422422
self.password_input.send_keys(password)
423-
Button(self.driver,
424-
xpath="//*[@content-desc='password-input']/../following-sibling::*//*[@text='Join Community']").click()
423+
self.login_button.click()
425424
if open_community:
426425
self.community_status_joined.wait_for_visibility_of_element(60)
427426

0 commit comments

Comments
 (0)