generate agent_secret for old users (#1021)

This commit is contained in:
UUBulb
2025-03-08 18:47:42 +08:00
committed by GitHub
parent 79884c781a
commit 9ee5595da7
4 changed files with 31 additions and 8 deletions

View File

@@ -13,6 +13,8 @@ const (
RoleMember
)
const DefaultAgentSecretLength = 32
type User struct {
Common
Username string `json:"username,omitempty" gorm:"uniqueIndex"`
@@ -32,7 +34,7 @@ func (u *User) BeforeSave(tx *gorm.DB) error {
return nil
}
key, err := utils.GenerateRandomString(32)
key, err := utils.GenerateRandomString(DefaultAgentSecretLength)
if err != nil {
return err
}