diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-12-01 11:34:17 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-12-01 11:36:24 +0800 |
commit | 1880cda9b95f3274d56e1f4abc513d1d7ddd59c2 (patch) | |
tree | 5db1151d5b09c6f82a4a02a85ff3ae5fea8018dd /ui/app | |
parent | 049e351c9d78dc13a81ba962b04ef96694b13682 (diff) | |
download | tangerine-wallet-browser-1880cda9b95f3274d56e1f4abc513d1d7ddd59c2.tar tangerine-wallet-browser-1880cda9b95f3274d56e1f4abc513d1d7ddd59c2.tar.gz tangerine-wallet-browser-1880cda9b95f3274d56e1f4abc513d1d7ddd59c2.tar.bz2 tangerine-wallet-browser-1880cda9b95f3274d56e1f4abc513d1d7ddd59c2.tar.lz tangerine-wallet-browser-1880cda9b95f3274d56e1f4abc513d1d7ddd59c2.tar.xz tangerine-wallet-browser-1880cda9b95f3274d56e1f4abc513d1d7ddd59c2.tar.zst tangerine-wallet-browser-1880cda9b95f3274d56e1f4abc513d1d7ddd59c2.zip |
Fix vault encrypting & unlocking bug
This is only a bug in dev, but was committed yesterday.
Sometimes the `encrypt` method was being passed values other than the password as the encryption key, leading to un-unlockable vaults.
To find this, and avoid it for all time hereafter, I added several more steps to our oft-neglected integration test suite, which now fully initializes a vault, locks it, and unlocks it again, to make sure all of those steps definitely work always.
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/actions.js | 25 | ||||
-rw-r--r-- | ui/app/reducers/app.js | 14 |
2 files changed, 32 insertions, 7 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 0cc55136f..41be1004c 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -5,7 +5,11 @@ var actions = { goHome: goHome, // menu state getNetworkStatus: 'getNetworkStatus', - + // transition state + TRANSITION_FORWARD: 'TRANSITION_FORWARD', + TRANSITION_BACKWARD: 'TRANSITION_BACKWARD', + transitionForward, + transitionBackward, // remote state UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE', updateMetamaskState: updateMetamaskState, @@ -166,16 +170,25 @@ function tryUnlockMetamask (password) { if (err) { dispatch(actions.unlockFailed(err.message)) } else { - let selectedAccount - try { - selectedAccount = newState.metamask.selectedAccount - } catch (e) {} - dispatch(actions.unlockMetamask(selectedAccount)) + dispatch(actions.transitionForward()) + dispatch(actions.updateMetamaskState(newState)) } }) } } +function transitionForward() { + return { + type: this.TRANSITION_FORWARD, + } +} + +function transitionBackward() { + return { + type: this.TRANSITION_BACKWARD, + } +} + function confirmSeedWords () { return (dispatch) => { dispatch(actions.showLoadingIndication()) diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 1f40e90b3..67a926948 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -43,7 +43,19 @@ function reduceApp (state, action) { switch (action.type) { - // intialize + // transition methods + + case actions.TRANSITION_FORWARD: + return extend(appState, { + transForward: true, + }) + + case actions.TRANSITION_BACKWARD: + return extend(appState, { + transForward: false, + }) + + // intialize case actions.SHOW_CREATE_VAULT: return extend(appState, { |