email limit & password limit

This commit is contained in:
eson
2023-10-11 11:55:44 +08:00
parent 5b483dadb5
commit c6fa875148
5 changed files with 14 additions and 1 deletions

View File

@@ -47,6 +47,10 @@ func (l *UserEmailRegisterLogic) UserEmailRegister(req *types.RequestEmailRegist
return resp.SetStatus(basic.CodeOAuthEmailErr)
}
if len(req.Email) > 50 {
return resp.SetStatusWithMessage(basic.CodeOAuthEmailErr, "email len must < 50")
}
if !TimeLimit.Is(req.Email) {
return resp.SetStatus(basic.CodeEmailTimeShortErr)
}

View File

@@ -41,6 +41,10 @@ func (l *UserRegisterLogic) UserRegister(req *types.RequestUserRegister, userinf
return resp.SetStatus(basic.CodeOAuthEmailErr)
}
if len(req.Email) > 50 {
return resp.SetStatusWithMessage(basic.CodeOAuthEmailErr, "email len must < 50")
}
// _, err := l.svcCtx.AllModels.FsUser.FindUserByEmail(l.ctx, req.Email)
// if err == nil {
// return resp.SetStatus(basic.CodeEmailExistsErr)

View File

@@ -39,6 +39,10 @@ func (l *UserResetPasswordLogic) UserResetPassword(req *types.RequestUserResetPa
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if len(req.NewPassword) > 30 {
return resp.SetStatusWithMessage(basic.CodePasswordErr, "password len must < 30")
}
rt, err := l.svcCtx.ResetTokenManger.Decrypt(req.ResetToken) // ResetToken
if err != nil {
logx.Error(err)