From 2ca4adb62cf605830f35ee89c0b42205bd98a3b5 Mon Sep 17 00:00:00 2001 From: maciejhirsz Date: Mon, 31 Jul 2017 17:51:23 +0200 Subject: [PATCH] Re-enable wallets, fixed forgetting accounts --- js/src/api/local/accounts/account.js | 4 ++++ js/src/api/local/accounts/accounts.js | 6 ++++++ js/src/api/local/localAccountsMiddleware.js | 4 ++++ js/src/views/Accounts/accounts.js | 4 ---- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/js/src/api/local/accounts/account.js b/js/src/api/local/accounts/account.js index 0bb069c8b..224a05cd9 100644 --- a/js/src/api/local/accounts/account.js +++ b/js/src/api/local/accounts/account.js @@ -31,6 +31,10 @@ export default class Account { } isValidPassword (password) { + if (!this._keyObject) { + return false; + } + return decryptPrivateKey(this._keyObject, password) .then((privateKey) => { if (!privateKey) { diff --git a/js/src/api/local/accounts/accounts.js b/js/src/api/local/accounts/accounts.js index 823ab3624..d11ea2bad 100644 --- a/js/src/api/local/accounts/accounts.js +++ b/js/src/api/local/accounts/accounts.js @@ -168,6 +168,12 @@ export default class Accounts { return false; } + if (!account.uuid) { + this.removeUnsafe(address); + + return true; + } + return account .isValidPassword(password) .then((isValid) => { diff --git a/js/src/api/local/localAccountsMiddleware.js b/js/src/api/local/localAccountsMiddleware.js index c8e767f89..c452f541a 100644 --- a/js/src/api/local/localAccountsMiddleware.js +++ b/js/src/api/local/localAccountsMiddleware.js @@ -206,6 +206,10 @@ export default class LocalAccountsMiddleware extends Middleware { return accounts.remove(address, password); }); + register('parity_removeAddress', ([address]) => { + return accounts.remove(address, null); + }); + register('parity_testPassword', ([address, password]) => { const account = accounts.get(address); diff --git a/js/src/views/Accounts/accounts.js b/js/src/views/Accounts/accounts.js index 2d37b7a4b..c8828cff6 100644 --- a/js/src/views/Accounts/accounts.js +++ b/js/src/views/Accounts/accounts.js @@ -373,10 +373,6 @@ class Accounts extends Component { } renderNewWalletButton () { - if (this.props.availability !== 'personal') { - return null; - } - return (