This commit is contained in:
laodaming
2023-11-17 10:07:05 +08:00
parent cc1b2a657b
commit 62222bb781
2 changed files with 18 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/chinese_to_pinyin"
"fusenapi/utils/email"
"fusenapi/utils/ldap_lib"
"strings"
@@ -46,8 +47,8 @@ func (l *CreateLdapUserLogic) CreateLdapUser(req *types.CreateLdapUserReq, useri
if req.Password == "" {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "密码不能为空")
}
if req.Email == "" {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "邮箱不能为空")
if !email.IsEmailValid(req.Email) {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "邮箱格式不正确")
}
ldapServer := ldap_lib.NewLdap(l.svcCtx.Ldap, l.svcCtx.Config.Ldap.BaseDN, l.svcCtx.Config.Ldap.RootDN)
//把用户名转pinyin