This commit is contained in:
laodaming 2023-11-21 10:38:11 +08:00
parent f946f2926a
commit 06b826769b
3 changed files with 13 additions and 11 deletions

View File

@ -55,6 +55,7 @@ func (l *UpdateLdapUserPwdLogic) UpdateLdapUserPwd(req *types.UpdateLdapUserPwdR
logx.Error(err) logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, err.Error()) return resp.SetStatusWithMessage(basic.CodeServiceErr, err.Error())
} }
if len(user.Password) > 7 && user.Password[:7] == "{crypt}" {
//解密旧的密码 //解密旧的密码
oldPwd, err := encryption_decryption.CBCDecrypt(user.Password[7:]) oldPwd, err := encryption_decryption.CBCDecrypt(user.Password[7:])
if err != nil { if err != nil {
@ -65,6 +66,7 @@ func (l *UpdateLdapUserPwdLogic) UpdateLdapUserPwd(req *types.UpdateLdapUserPwdR
if oldPwd != req.OldPassword { if oldPwd != req.OldPassword {
return resp.SetStatusWithMessage(basic.CodeServiceErr, "旧密码不对,请重新尝试") return resp.SetStatusWithMessage(basic.CodeServiceErr, "旧密码不对,请重新尝试")
} }
}
//加密新的密码 //加密新的密码
newPwd, err := encryption_decryption.CBCEncrypt(req.NewPassword) newPwd, err := encryption_decryption.CBCEncrypt(req.NewPassword)
if err != nil { if err != nil {

View File

@ -166,7 +166,7 @@ type GetLdapUserInfoReq struct {
} }
type GetLdapUserInfoRsp struct { type GetLdapUserInfoRsp struct {
UserId int64 `json:"userId"` UserId int64 `json:"user_id"`
UserDN string `json:"user_dn"` UserDN string `json:"user_dn"`
UserName string `json:"user_name"` //用户名 UserName string `json:"user_name"` //用户名
Email string `json:"email"` //邮箱 Email string `json:"email"` //邮箱

View File

@ -249,7 +249,7 @@ type GetLdapUserInfoReq {
UserDN string `form:"user_dn"` //用户dn UserDN string `form:"user_dn"` //用户dn
} }
type GetLdapUserInfoRsp { type GetLdapUserInfoRsp {
UserId int64 `json:"userId"` UserId int64 `json:"user_id"`
UserDN string `json:"user_dn"` UserDN string `json:"user_dn"`
UserName string `json:"user_name"` //用户名 UserName string `json:"user_name"` //用户名
Email string `json:"email"` //邮箱 Email string `json:"email"` //邮箱