From eebf987900b6f63afae4ca6c953598dd6670b9ff Mon Sep 17 00:00:00 2001 From: Shawn Wang Date: Thu, 13 Dec 2018 10:39:09 +0000 Subject: [PATCH] Fix UserKey.Key for govalidator.ValidateStruct. UserKey.Key is a []byte field. The valid: "required" would cause wrong Validation. --- db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.go b/db.go index a34dc85..7c65f45 100644 --- a/db.go +++ b/db.go @@ -70,7 +70,7 @@ type Host struct { // UserKey defines a user public key used by sshportal to identify the user type UserKey struct { gorm.Model - Key []byte `sql:"size:10000" valid:"required,length(1|10000)"` + Key []byte `sql:"size:10000" valid:"length(1|10000)"` AuthorizedKey string `sql:"size:10000" valid:"required,length(1|10000)"` UserID uint `` User *User `gorm:"ForeignKey:UserID"`