aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-04 07:06:57 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-04 07:14:37 +0800
commitba7d6b437f2e03a9e2bb46dcda846cee1f816ce1 (patch)
tree001b0fe49f3d25c392e5d65ebb17973cabc1c920 /app
parent2afc06287dfd1a87bd247234c9a04b92a8394cac (diff)
downloadtangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.gz
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.bz2
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.lz
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.xz
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.tar.zst
tangerine-wallet-browser-ba7d6b437f2e03a9e2bb46dcda846cee1f816ce1.zip
Fix password validation and persistence issue
Was wiping the vault on each successful password attempt... :P
Diffstat (limited to 'app')
-rw-r--r--app/scripts/keyring-controller.js9
-rw-r--r--app/scripts/lib/encryptor.js3
2 files changed, 8 insertions, 4 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index aa303c43c..81a05e133 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -131,9 +131,7 @@ module.exports = class KeyringController extends EventEmitter {
this.keyrings.push(keyring)
this.configManager.setSelectedAccount(keyring.getAccounts()[0])
}
- return this.persistAllKeyrings().then(() => {
- return key
- })
+ return key
})
}
@@ -144,6 +142,9 @@ module.exports = class KeyringController extends EventEmitter {
return this.migrateAndGetKey(password)
.then(() => {
+ return this.persistAllKeyrings()
+ })
+ .then(() => {
cb(null)
})
.catch((err) => {
@@ -173,7 +174,7 @@ module.exports = class KeyringController extends EventEmitter {
})
}
- placeSeedWords () {
+ placeSeedWords (cb) {
const firstKeyring = this.keyrings[0]
const seedWords = firstKeyring.serialize().mnemonic
this.configManager.setSeedWords(seedWords)
diff --git a/app/scripts/lib/encryptor.js b/app/scripts/lib/encryptor.js
index 832e6d528..fe83b86dd 100644
--- a/app/scripts/lib/encryptor.js
+++ b/app/scripts/lib/encryptor.js
@@ -69,6 +69,9 @@ function decryptWithKey (key, text) {
const decryptedObj = JSON.parse(decryptedStr)
return decryptedObj
})
+ .catch(function(reason) {
+ throw new Error('Incorrect password')
+ })
}
function convertStringToArrayBufferView (str) {