Fix UserKey.Key for govalidator.ValidateStruct.

UserKey.Key is a []byte field.
The valid: "required" would cause wrong Validation.
This commit is contained in:
Shawn Wang 2018-12-13 10:39:09 +00:00
parent 3d5101011f
commit eebf987900

2
db.go
View file

@ -70,7 +70,7 @@ type Host struct {
// UserKey defines a user public key used by sshportal to identify the user // UserKey defines a user public key used by sshportal to identify the user
type UserKey struct { type UserKey struct {
gorm.Model 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)"` AuthorizedKey string `sql:"size:10000" valid:"required,length(1|10000)"`
UserID uint `` UserID uint ``
User *User `gorm:"ForeignKey:UserID"` User *User `gorm:"ForeignKey:UserID"`