diff --git a/model/user.go b/model/user.go index e738b1ba..904ad686 100644 --- a/model/user.go +++ b/model/user.go @@ -3,18 +3,19 @@ package model import ( "errors" "fmt" - "gorm.io/gorm" "one-api/common" "strings" + + "gorm.io/gorm" ) // User if you add sensitive fields, don't forget to clean them in setupLogin function. // Otherwise, the sensitive information will be saved on local storage in plain text! type User struct { Id int `json:"id"` - Username string `json:"username" gorm:"unique;index" validate:"max=12"` - Password string `json:"password" gorm:"not null;" validate:"min=8,max=20"` - DisplayName string `json:"display_name" gorm:"index" validate:"max=20"` + Username string `json:"username" gorm:"unique;index" validate:"max=255"` + Password string `json:"password" gorm:"not null;" validate:"min=8,max=255"` + DisplayName string `json:"display_name" gorm:"index" validate:"max=255"` Role int `json:"role" gorm:"type:int;default:1"` // admin, common Status int `json:"status" gorm:"type:int;default:1"` // enabled, disabled Email string `json:"email" gorm:"index" validate:"max=50"`