mirror of https://github.com/cloudreve/Cloudreve
fix(session): increase password length limit to 128
parent
10e3854082
commit
006bcabcdb
|
@ -165,6 +165,10 @@ func (s *UpsertUserService) Update(c *gin.Context) (*GetUserResponse, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.Password != "" && len(s.Password) > 128 {
|
||||||
|
return nil, serializer.NewError(serializer.CodeParamErr, "Password too long", nil)
|
||||||
|
}
|
||||||
|
|
||||||
newUser, err := userClient.Upsert(ctx, s.User, s.Password, s.TwoFA)
|
newUser, err := userClient.Upsert(ctx, s.User, s.Password, s.TwoFA)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, serializer.NewError(serializer.CodeDBError, "Failed to update user", err)
|
return nil, serializer.NewError(serializer.CodeDBError, "Failed to update user", err)
|
||||||
|
|
|
@ -25,13 +25,13 @@ type LoginParameterCtx struct{}
|
||||||
// UserLoginService 管理用户登录的服务
|
// UserLoginService 管理用户登录的服务
|
||||||
type UserLoginService struct {
|
type UserLoginService struct {
|
||||||
UserName string `form:"email" json:"email" binding:"required,email"`
|
UserName string `form:"email" json:"email" binding:"required,email"`
|
||||||
Password string `form:"password" json:"password" binding:"required,min=4,max=64"`
|
Password string `form:"password" json:"password" binding:"required,min=4,max=128"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// UserResetService 密码重设服务
|
// UserResetService 密码重设服务
|
||||||
UserResetService struct {
|
UserResetService struct {
|
||||||
Password string `form:"password" json:"password" binding:"required,min=6,max=64"`
|
Password string `form:"password" json:"password" binding:"required,min=6,max=128"`
|
||||||
Secret string `json:"secret" binding:"required"`
|
Secret string `json:"secret" binding:"required"`
|
||||||
}
|
}
|
||||||
UserResetParameterCtx struct{}
|
UserResetParameterCtx struct{}
|
||||||
|
|
|
@ -25,7 +25,7 @@ type RegisterParameterCtx struct{}
|
||||||
// UserRegisterService 管理用户注册的服务
|
// UserRegisterService 管理用户注册的服务
|
||||||
type UserRegisterService struct {
|
type UserRegisterService struct {
|
||||||
UserName string `form:"email" json:"email" binding:"required,email"`
|
UserName string `form:"email" json:"email" binding:"required,email"`
|
||||||
Password string `form:"password" json:"password" binding:"required,min=6,max=64"`
|
Password string `form:"password" json:"password" binding:"required,min=6,max=128"`
|
||||||
Language string `form:"language" json:"language"`
|
Language string `form:"language" json:"language"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,8 +215,8 @@ type (
|
||||||
VersionRetentionEnabled *bool `json:"version_retention_enabled" binding:"omitempty"`
|
VersionRetentionEnabled *bool `json:"version_retention_enabled" binding:"omitempty"`
|
||||||
VersionRetentionExt *[]string `json:"version_retention_ext" binding:"omitempty"`
|
VersionRetentionExt *[]string `json:"version_retention_ext" binding:"omitempty"`
|
||||||
VersionRetentionMax *int `json:"version_retention_max" binding:"omitempty,min=0"`
|
VersionRetentionMax *int `json:"version_retention_max" binding:"omitempty,min=0"`
|
||||||
CurrentPassword *string `json:"current_password" binding:"omitempty,min=4,max=64"`
|
CurrentPassword *string `json:"current_password" binding:"omitempty,min=4,max=128"`
|
||||||
NewPassword *string `json:"new_password" binding:"omitempty,min=6,max=64"`
|
NewPassword *string `json:"new_password" binding:"omitempty,min=6,max=128"`
|
||||||
TwoFAEnabled *bool `json:"two_fa_enabled" binding:"omitempty"`
|
TwoFAEnabled *bool `json:"two_fa_enabled" binding:"omitempty"`
|
||||||
TwoFACode *string `json:"two_fa_code" binding:"omitempty"`
|
TwoFACode *string `json:"two_fa_code" binding:"omitempty"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue