signer: allow space in passwords, improve error messsage

This commit is contained in:
Martin Holst Swende 2018-09-25 11:11:29 +02:00
parent 626cf5de17
commit ebe46a48f3
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
3 changed files with 11 additions and 11 deletions

View file

@ -80,14 +80,14 @@ func (l *AuditLogger) Export(ctx context.Context, addr common.Address) (json.Raw
return j, e return j, e
} }
func (l *AuditLogger) Import(ctx context.Context, keyJSON json.RawMessage) (Account, error) { //func (l *AuditLogger) Import(ctx context.Context, keyJSON json.RawMessage) (Account, error) {
// Don't actually log the json contents // // Don't actually log the json contents
l.log.Info("Import", "type", "request", "metadata", MetadataFromContext(ctx).String(), // l.log.Info("Import", "type", "request", "metadata", MetadataFromContext(ctx).String(),
"keyJSON size", len(keyJSON)) // "keyJSON size", len(keyJSON))
a, e := l.api.Import(ctx, keyJSON) // a, e := l.api.Import(ctx, keyJSON)
l.log.Info("Import", "type", "response", "addr", a.String(), "error", e) // l.log.Info("Import", "type", "response", "addr", a.String(), "error", e)
return a, e // return a, e
} //}
func NewAuditLogger(path string, api ExternalAPI) (*AuditLogger, error) { func NewAuditLogger(path string, api ExternalAPI) (*AuditLogger, error) {
l := log.New("api", "signer") l := log.New("api", "signer")

View file

@ -165,7 +165,7 @@ func ValidatePasswordFormat(password string) error {
return errors.New("password too short (<10 characters)") return errors.New("password too short (<10 characters)")
} }
if !Printable7BitAscii.MatchString(password) { if !Printable7BitAscii.MatchString(password) {
return errors.New("password contains invalid characters - allowed set (7bit printable ascii) is A-Z, a-z, 0-9, and !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") return errors.New("password contains invalid characters - only 7bit printable ascii allowed")
} }
return nil return nil
} }