diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-04-20 15:37:45 +0800 |
---|---|---|
committer | Guillaume Ballet <gballet@gmail.com> | 2019-04-08 19:19:37 +0800 |
commit | 7d5886dcf4412b9c4459d67ab51d61e7ce30421d (patch) | |
tree | 4d6b5c1fbf36bad2ada951e2ce81394bab91e113 /console | |
parent | 386943943f3f17ef2af98c99d14df2c259e189c9 (diff) | |
download | go-tangerine-7d5886dcf4412b9c4459d67ab51d61e7ce30421d.tar go-tangerine-7d5886dcf4412b9c4459d67ab51d61e7ce30421d.tar.gz go-tangerine-7d5886dcf4412b9c4459d67ab51d61e7ce30421d.tar.bz2 go-tangerine-7d5886dcf4412b9c4459d67ab51d61e7ce30421d.tar.lz go-tangerine-7d5886dcf4412b9c4459d67ab51d61e7ce30421d.tar.xz go-tangerine-7d5886dcf4412b9c4459d67ab51d61e7ce30421d.tar.zst go-tangerine-7d5886dcf4412b9c4459d67ab51d61e7ce30421d.zip |
accounts, console: frendly card errors, support pin unblock
Diffstat (limited to 'console')
-rw-r--r-- | console/bridge.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/console/bridge.go b/console/bridge.go index 03d97e0ef..e90991dc6 100644 --- a/console/bridge.go +++ b/console/bridge.go @@ -141,6 +141,24 @@ func (b *bridge) OpenWallet(call otto.FunctionCall) (response otto.Value) { } } + case strings.HasSuffix(err.Error(), scwallet.ErrPINUnblockNeeded.Error()): + // PIN unblock requested, fetch PUK and new PIN from the user + var pukpin string + if input, err := b.prompter.PromptPassword("Please enter current PUK: "); err != nil { + throwJSException(err.Error()) + } else { + pukpin = input + } + if input, err := b.prompter.PromptPassword("Please enter new PIN: "); err != nil { + throwJSException(err.Error()) + } else { + pukpin += input + } + passwd, _ = otto.ToValue(pukpin) + if val, err = call.Otto.Call("jeth.openWallet", nil, wallet, passwd); err != nil { + throwJSException(err.Error()) + } + case strings.HasSuffix(err.Error(), scwallet.ErrPINNeeded.Error()): // PIN input requested, fetch from the user and call open again if input, err := b.prompter.PromptPassword("Please enter current PIN: "); err != nil { |