new features: Based on IP user registration restrictions

This commit is contained in:
EUForest
2025-11-13 14:52:02 +08:00
parent 0fb92f380f
commit ff2d3f85f3
7 changed files with 60 additions and 1 deletions
+5
View File
@@ -86,6 +86,11 @@ func (l *UserRegisterLogic) UserRegister(req *types.UserRegisterRequest) (resp *
} else if err == nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.UserExist), "user email exist: %v", req.Email)
}
if !registerIpLimit(l.svcCtx, l.ctx, req.IP, "email", req.Email) {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.RegisterIPLimit), "register ip limit: %v", req.IP)
}
// Generate password
pwd := tool.EncodePassWord(req.Password)
userInfo := &user.User{