[#10141] Unable to login to multiaccount if it is already restored as account in another multiaccount (IOS)

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2020-03-12 12:52:57 +01:00
parent 3cf282e75a
commit b8861c6c14
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 25 additions and 20 deletions

View File

@ -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]}))

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' 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"
}