From b8861c6c148afa897de68df70ac3f8889bb9f72c Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Thu, 12 Mar 2020 12:52:57 +0100 Subject: [PATCH] [#10141] Unable to login to multiaccount if it is already restored as account in another multiaccount (IOS) Signed-off-by: Andrey Shovkoplyas --- src/status_im/multiaccounts/recover/core.cljs | 39 +++++++++++-------- status-go-version.json | 6 +-- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/status_im/multiaccounts/recover/core.cljs b/src/status_im/multiaccounts/recover/core.cljs index 5768349fc9..74e2e4819f 100644 --- a/src/status_im/multiaccounts/recover/core.cljs +++ b/src/status_im/multiaccounts/recover/core.cljs @@ -52,22 +52,27 @@ {:events [::store-multiaccount-success] :interceptors [(re-frame/inject-cofx :random-guid-generator) (re-frame/inject-cofx ::multiaccounts.create/get-signing-phrase)]} - [{:keys [db] :as cofx} password] - (let [{:keys [key-uid] :as multiaccount} (get-in db [:intro-wizard :root-key]) - keycard-multiaccount? (boolean (get-in db [:multiaccounts/multiaccounts key-uid :keycard-pairing]))] - (if keycard-multiaccount? - ;; trying to recover multiaccount created with keycard - {:db (-> db - (update :intro-wizard assoc - :processing? false - :passphrase-error :recover-keycard-multiaccount-not-supported) - (update :intro-wizard dissoc - :passphrase-valid?))} - (let [multiaccount (assoc multiaccount :derived (get-in db [:intro-wizard :derived]))] - (multiaccounts.create/on-multiaccount-created cofx - multiaccount - password - {}))))) + [{:keys [db] :as cofx} result password] + (let [{:keys [error]} (types/json->clj result)] + (if error + {:utils/show-popup {:title (i18n/label :t/multiaccount-exists-title) + :content (i18n/label :t/multiaccount-exists-title) + :on-dismiss #(re-frame/dispatch [:navigate-to :multiaccounts])}} + (let [{:keys [key-uid] :as multiaccount} (get-in db [:intro-wizard :root-key]) + keycard-multiaccount? (boolean (get-in db [:multiaccounts/multiaccounts key-uid :keycard-pairing]))] + (if keycard-multiaccount? + ;; trying to recover multiaccount created with keycard + {:db (-> db + (update :intro-wizard assoc + :processing? false + :passphrase-error :recover-keycard-multiaccount-not-supported) + (update :intro-wizard dissoc + :passphrase-valid?))} + (let [multiaccount (assoc multiaccount :derived (get-in db [:intro-wizard :derived]))] + (multiaccounts.create/on-multiaccount-created cofx + multiaccount + password + {}))))))) (fx/defn store-multiaccount {:events [::recover-multiaccount-confirmed]} @@ -75,7 +80,7 @@ (let [password (get-in db [:intro-wizard :key-code]) {:keys [root-key]} (:intro-wizard db) {:keys [id]} root-key - callback #(re-frame/dispatch [::store-multiaccount-success password]) + callback #(re-frame/dispatch [::store-multiaccount-success % password]) hashed-password (ethereum/sha3 (security/safe-unmask-data password))] {:db (assoc-in db [:intro-wizard :processing?] true) ::multiaccounts.create/store-multiaccount [id hashed-password callback]})) diff --git a/status-go-version.json b/status-go-version.json index 69fcceae43..4bead05291 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.48.8", - "commit-sha1": "d1beb4c76d9fabcd00da75ad63430104f92c1404", - "src-sha256": "0sx85hg5c1dap2cnf44kqgp0lbknl4wd3n47cchiivnlmv4c9gw8" + "version": "v0.49.0", + "commit-sha1": "d7bb02540a4356fb507a08ed73491c659b076fb1", + "src-sha256": "0i6s085qq67aiyzjs2lrjfnaqvbh1v1jxdsi84c176y150lwb8lw" }