|
@@ -442,28 +442,36 @@ func (this *SysAdminController) Add() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var pass string
|
|
|
- if req.IsLdap == 0 {
|
|
|
+ var originPass, pass string
|
|
|
+ if req.Password != "" {
|
|
|
pwdByte, e := base64.StdEncoding.DecodeString(req.Password)
|
|
|
if e != nil {
|
|
|
br.Msg = "解析数据失败"
|
|
|
br.ErrMsg = "解析数据失败,Err:" + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- pwdStr := string(pwdByte)
|
|
|
- if pwdStr == "" {
|
|
|
+ originPass = string(pwdByte)
|
|
|
+ }
|
|
|
+ // 系统用户-密码必填且需要校验密码格式
|
|
|
+ if req.IsLdap == 0 {
|
|
|
+ if originPass == "" {
|
|
|
br.Msg = "请输入密码"
|
|
|
return
|
|
|
}
|
|
|
- if !utils.CheckPwd(pwdStr) {
|
|
|
+ if !utils.CheckPwd(originPass) {
|
|
|
br.Msg = "密码格式错误,请重新输入"
|
|
|
return
|
|
|
}
|
|
|
- pass = utils.MD5(pwdStr)
|
|
|
+ pass = utils.MD5(originPass)
|
|
|
}
|
|
|
- // 如果是域用户, 那么给个初始密码即可(实际登录用不到这个密码)
|
|
|
+ // 域用户-密码非必填(实际登录用不到这个密码)
|
|
|
if req.IsLdap == 1 {
|
|
|
- pass = utils.MD5(utils.LdapInitPassword)
|
|
|
+ if originPass != "" {
|
|
|
+ pass = utils.MD5(originPass)
|
|
|
+ } else {
|
|
|
+ // 未填写的话给个初始密码即可
|
|
|
+ pass = utils.MD5(utils.LdapInitPassword)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 员工工号
|