* allow empty string passwords for unlocking account

This commit is contained in:
Ales Katona 2015-08-25 18:24:42 -06:00
parent abce09954b
commit 3127734208
2 changed files with 4 additions and 1 deletions

View file

@ -126,7 +126,7 @@ func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error)
return nil, shared.NewDecodeParamError(err.Error()) return nil, shared.NewDecodeParamError(err.Error())
} }
if len(args.Passphrase) == 0 { if !args.HasPW {
fe := self.xeth.Frontend() fe := self.xeth.Frontend()
if fe == nil { if fe == nil {
return false, fmt.Errorf("No password provided") return false, fmt.Errorf("No password provided")

View file

@ -77,6 +77,7 @@ func (args *DeleteAccountArgs) UnmarshalJSON(b []byte) (err error) {
type UnlockAccountArgs struct { type UnlockAccountArgs struct {
Address string Address string
Passphrase string Passphrase string
HasPW bool
Duration int Duration int
} }
@ -87,6 +88,7 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) {
} }
args.Duration = 0 args.Duration = 0
args.HasPW = false
if len(obj) < 1 { if len(obj) < 1 {
return shared.NewInsufficientParamsError(len(obj), 1) return shared.NewInsufficientParamsError(len(obj), 1)
@ -101,6 +103,7 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) {
if len(obj) >= 2 && obj[1] != nil { if len(obj) >= 2 && obj[1] != nil {
if passphrasestr, ok := obj[1].(string); ok { if passphrasestr, ok := obj[1].(string); ok {
args.Passphrase = passphrasestr args.Passphrase = passphrasestr
args.HasPW = true
} else { } else {
return shared.NewInvalidTypeError("passphrase", "not a string") return shared.NewInvalidTypeError("passphrase", "not a string")
} }