diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-23 00:27:05 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-23 00:27:05 +0800 |
commit | dce503779b2866d1d35b4582470604c0d7e156db (patch) | |
tree | 7d8817ec84be38b911f967f1ecd5618d02e4caa9 /rpc/api/personal.go | |
parent | 58d0752fdd1c7363fb1a127cd7e0a86d7602be02 (diff) | |
parent | 8b81ad1fc40080af441c0c6df94f0b2ea46e320b (diff) | |
download | go-tangerine-dce503779b2866d1d35b4582470604c0d7e156db.tar go-tangerine-dce503779b2866d1d35b4582470604c0d7e156db.tar.gz go-tangerine-dce503779b2866d1d35b4582470604c0d7e156db.tar.bz2 go-tangerine-dce503779b2866d1d35b4582470604c0d7e156db.tar.lz go-tangerine-dce503779b2866d1d35b4582470604c0d7e156db.tar.xz go-tangerine-dce503779b2866d1d35b4582470604c0d7e156db.tar.zst go-tangerine-dce503779b2866d1d35b4582470604c0d7e156db.zip |
Merge pull request #1840 from ethersphere/console
console, cli, api fixes
Diffstat (limited to 'rpc/api/personal.go')
-rw-r--r-- | rpc/api/personal.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/rpc/api/personal.go b/rpc/api/personal.go index 1fb412612..4f347c610 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -98,9 +98,22 @@ func (self *personalApi) NewAccount(req *shared.Request) (interface{}, error) { if err := self.codec.Decode(req.Params, &args); err != nil { return nil, shared.NewDecodeParamError(err.Error()) } - + var passwd string + if args.Passphrase == nil { + fe := self.xeth.Frontend() + if fe == nil { + return false, fmt.Errorf("unable to create account: unable to interact with user") + } + var ok bool + passwd, ok = fe.AskPassword() + if !ok { + return false, fmt.Errorf("unable to create account: no password given") + } + } else { + passwd = *args.Passphrase + } am := self.ethereum.AccountManager() - acc, err := am.NewAccount(args.Passphrase) + acc, err := am.NewAccount(passwd) return acc.Address.Hex(), err } |