Authored by qinchao

ldap登录

... ... @@ -61,6 +61,12 @@ public class ManagerCtrl {
if (StringUtils.isNotBlank(user.getModuleGroups()) && StringUtils.endsWith(user.getModuleGroups(), ",")) {
user.setModuleGroups(user.getModuleGroups().substring(0, user.getModuleGroups().length() - 1));
}
if(StringUtils.isBlank(user.getEmail())||StringUtils.isBlank(user.getMobile())){
return new BaseResponse(201, "邮箱、手机号不能为空");
}
if(StringUtils.isBlank(user.getLadpName())){
user.setLadpName(user.getEmail().substring(0,user.getEmail().indexOf("@")));
}
if (user.getId() < 1) {//add
if (userAuthLocal.getUserByname(user.getName()) != null) {
return new BaseResponse(201, "用户已经存在");
... ...
... ... @@ -68,9 +68,12 @@ public class UserCtrl {
}
boolean ldapFlag=false;
BaseResponse ldapFlagResp=httpRestClient.defaultGet(HttpUriContants.USER_LDAP_FLAG,BaseResponse.class);
if(ldapFlagResp!=null&&ldapFlagResp.getCode()==200&&ldapFlagResp.getData()!=null&&"1".equals(String.valueOf(ldapFlagResp.getData()))){
ldapFlag=true;
// 给admin留一个后门,防止ldap不能验证
if(!"admin".equals(user.getName())){
BaseResponse ldapFlagResp=httpRestClient.defaultGet(HttpUriContants.USER_LDAP_FLAG,BaseResponse.class);
if(ldapFlagResp!=null&&ldapFlagResp.getCode()==200&&ldapFlagResp.getData()!=null&&"1".equals(String.valueOf(ldapFlagResp.getData()))){
ldapFlag=true;
}
}
User u =null;
... ...
... ... @@ -382,6 +382,22 @@
return;
}
if (email == null || email == "") {
$("#hostGroupForm #messageAlert").alerts({
content: "请输入邮箱",
type: "danger"
});
return;
}
if (mobile == null || mobile == "") {
$("#hostGroupForm #messageAlert").alerts({
content: "请输入手机号",
type: "danger"
});
return;
}
var param = {
id:id,
name: name,
... ...