Redirect to multiaccounts only on explicit logout

Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
Gheorghe Pinzaru 2020-03-03 14:20:16 +03:00
parent 5301d421f2
commit 6d3ef2282f
No known key found for this signature in database
GPG Key ID: C9A094959935A952
1 changed files with 6 additions and 4 deletions

View File

@ -9,12 +9,12 @@
[status-im.ui.screens.navigation :as navigation]
[status-im.utils.keychain.core :as keychain]))
(fx/defn logout-method [{:keys [db] :as cofx} auth-method]
(fx/defn logout-method [{:keys [db] :as cofx} {:keys [auth-method logout?]}]
(let [key-uid (get-in db [:multiaccount :key-uid])]
(fx/merge cofx
{::logout nil
:keychain/clear-user-password key-uid
::init/open-multiaccounts #(re-frame/dispatch [::init/initialize-multiaccounts % {:logout? true}])}
::init/open-multiaccounts #(re-frame/dispatch [::init/initialize-multiaccounts % {:logout? logout?}])}
(keychain/save-auth-method key-uid auth-method)
(transport/stop-whisper)
(chaos-mode/stop-checking)
@ -23,7 +23,8 @@
(fx/defn logout
{:events [:logout]}
[cofx]
(logout-method cofx keychain/auth-method-none))
(logout-method cofx {:auth-method keychain/auth-method-none
:logout? true}))
(fx/defn show-logout-confirmation [_]
{:ui/show-confirmation
@ -37,7 +38,8 @@
{:events [:biometric-logout]}
[cofx]
(fx/merge cofx
(logout-method keychain/auth-method-biometric-prepare)
(logout-method {:auth-method keychain/auth-method-biometric-prepare
:logout? false})
(fn [{:keys [db]}]
{:db (assoc-in db [:multiaccounts/login :save-password?] true)})))