diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-04-22 15:14:40 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-04-23 00:24:21 +0800 |
commit | 3082d2e4ef02306d5c09fbd1032a22d2efa33324 (patch) | |
tree | a51591358ceb63b4704ff415b783dc6312da6548 /ui/app/actions.js | |
parent | 477b74124d24c9497fafb0c976eba27712c69d79 (diff) | |
download | tangerine-wallet-browser-3082d2e4ef02306d5c09fbd1032a22d2efa33324.tar tangerine-wallet-browser-3082d2e4ef02306d5c09fbd1032a22d2efa33324.tar.gz tangerine-wallet-browser-3082d2e4ef02306d5c09fbd1032a22d2efa33324.tar.bz2 tangerine-wallet-browser-3082d2e4ef02306d5c09fbd1032a22d2efa33324.tar.lz tangerine-wallet-browser-3082d2e4ef02306d5c09fbd1032a22d2efa33324.tar.xz tangerine-wallet-browser-3082d2e4ef02306d5c09fbd1032a22d2efa33324.tar.zst tangerine-wallet-browser-3082d2e4ef02306d5c09fbd1032a22d2efa33324.zip |
Use new design for reveal seed screen. Persist seed words only in first time flow
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index f5cdd32bc..62875c629 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -83,7 +83,7 @@ var actions = { REVEAL_SEED_CONFIRMATION: 'REVEAL_SEED_CONFIRMATION', revealSeedConfirmation: revealSeedConfirmation, requestRevealSeed: requestRevealSeed, - + requestRevealSeedWords, // unlock screen UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS', UNLOCK_FAILED: 'UNLOCK_FAILED', @@ -427,6 +427,30 @@ function revealSeedConfirmation () { } } +function verifyPassword (password) { + return new Promise((resolve, reject) => { + background.submitPassword(password, error => { + if (error) { + return reject(error) + } + + resolve(true) + }) + }) +} + +function verifySeedPhrase () { + return new Promise((resolve, reject) => { + background.verifySeedPhrase((error, seedWords) => { + if (error) { + return reject(error) + } + + resolve(seedWords) + }) + }) +} + function requestRevealSeed (password) { return dispatch => { dispatch(actions.showLoadingIndication()) @@ -454,6 +478,24 @@ function requestRevealSeed (password) { } } +function requestRevealSeedWords (password) { + return async dispatch => { + dispatch(actions.showLoadingIndication()) + log.debug(`background.submitPassword`) + + try { + await verifyPassword(password) + const seedWords = await verifySeedPhrase() + dispatch(actions.hideLoadingIndication()) + return seedWords + } catch (error) { + dispatch(actions.hideLoadingIndication()) + dispatch(actions.displayWarning(error.message)) + throw new Error(error.message) + } + } +} + function resetAccount () { return (dispatch) => { background.resetAccount((err, account) => { |