From 2aac9aeec7c014b3e2976ecd41969ac6558f16fb Mon Sep 17 00:00:00 2001 From: zhaoyii <532708564@qq.com> Date: Wed, 27 Dec 2023 16:28:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=20Username=20Password?= =?UTF-8?q?=20DisplayName=20=E7=9A=84=E6=9C=80=E5=A4=A7=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/user.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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"`