diff --git a/lnbits/extensions/watchonly/static/components/payment/payment.js b/lnbits/extensions/watchonly/static/components/payment/payment.js index a70ea795..02ce538a 100644 --- a/lnbits/extensions/watchonly/static/components/payment/payment.js +++ b/lnbits/extensions/watchonly/static/components/payment/payment.js @@ -88,7 +88,8 @@ async function payment(path) { } if (!this.serialSignerRef.isAuthenticated()) { await this.serialSignerRef.hwwShowPasswordDialog() - return + const authenticated = await this.serialSignerRef.isAuthenticating() + if (!authenticated) return } await this.createPsbt() diff --git a/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.html b/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.html index abe156ef..b2c8f59d 100644 --- a/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.html +++ b/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.html @@ -158,7 +158,9 @@
- Check data on the display of the hardware device. + + Check data on the display of the hardware device. +
@@ -167,6 +169,13 @@ Output {{hww.confirm.outputIndex}} + + change +
@@ -207,7 +216,7 @@
diff --git a/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.js b/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.js index 37c83cf1..8ea93a28 100644 --- a/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.js +++ b/lnbits/extensions/watchonly/static/components/serial-signer/serial-signer.js @@ -29,10 +29,10 @@ async function serialSigner(path) { sendingPsbt: false, signingPsbt: false, psbtSentResolve: null, + loginResolve: null, confirm: { outputIndex: 0, - showFee: false, - confirmed: false + showFee: false } }, tx: null, // todo: move to hww @@ -122,6 +122,13 @@ async function serialSigner(path) { isAuthenticated: function () { return this.hww.authenticated }, + isAuthenticating: function () { + if (this.isAuthenticated()) return false + return new Promise(resolve => { + this.loginResolve = resolve + }) + }, + isSendingPsbt: async function () { if (!this.hww.sendingPsbt) return false return new Promise(resolve => { @@ -229,10 +236,6 @@ async function serialSigner(path) { } }, hwwConfirmNext: async function () { - if (this.hww.confirm.showFee === true) { - this.hww.confirm.confirmed = true - return - } this.hww.confirm.outputIndex += 1 if (this.hww.confirm.outputIndex >= this.tx.outputs.length) { this.hww.confirm.showFee = true @@ -271,6 +274,7 @@ async function serialSigner(path) { }, handleLoginResponse: function (res = '') { this.hww.authenticated = res.trim() === '1' + this.loginResolve(this.hww.authenticated) if (this.hww.authenticated) { this.$q.notify({ type: 'positive', @@ -333,8 +337,7 @@ async function serialSigner(path) { this.hww.showConfirmationDialog = true this.hww.confirm = { outputIndex: 0, - showFee: false, - confirmed: false + showFee: false } this.hww.sendingPsbt = false this.psbtSentResolve()