implement tux's fix for changing property name and more consistent behavior around setting passphrase on unencrypted wallet

This commit is contained in:
Bucko 2017-08-30 14:32:24 -07:00
parent 7145d21c9c
commit 778e118378
2 changed files with 3 additions and 8 deletions

View File

@ -673,7 +673,7 @@ HTTPClient.prototype.retoken = async function retoken(id, passphrase) {
*/ */
HTTPClient.prototype.setPassphrase = function setPassphrase(id, old, new_) { HTTPClient.prototype.setPassphrase = function setPassphrase(id, old, new_) {
const body = { old: old, passphrase: new_ }; const body = { old: old, new: new_ };
return this._post(`/wallet/${id}/passphrase`, body); return this._post(`/wallet/${id}/passphrase`, body);
}; };

View File

@ -366,15 +366,10 @@ Wallet.prototype._removeSharedKey = async function _removeSharedKey(acct, key) {
*/ */
Wallet.prototype.setPassphrase = async function setPassphrase(old, new_) { Wallet.prototype.setPassphrase = async function setPassphrase(old, new_) {
if (new_ == null) { if (old)
new_ = old;
old = null;
}
if (old != null)
await this.decrypt(old); await this.decrypt(old);
if (new_ != null) if (new_)
await this.encrypt(new_); await this.encrypt(new_);
}; };