|
@@ -342,17 +342,12 @@ public class UserController {
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/loginForAd", method = RequestMethod.POST)
|
|
|
- public HttpRespMsg loginForAd(@RequestParam String username, @RequestParam String passWord) {
|
|
|
+ public HttpRespMsg loginForAd(@RequestParam String username, @RequestParam String password) {
|
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
- User user = userService.getOne(new QueryWrapper<User>().eq("phone", username+"@"+dcFirst+"."+dcSecond));
|
|
|
if(username.equals("sysadmin")){
|
|
|
- if(user!=null){
|
|
|
- return loginByUserId(user.getId());
|
|
|
- }else {
|
|
|
- httpRespMsg.setError("账号不存在");
|
|
|
- return httpRespMsg;
|
|
|
- }
|
|
|
+ return loginAdmin(username,password);
|
|
|
}
|
|
|
+ User user = userService.getOne(new QueryWrapper<User>().eq("phone", username+"@"+dcFirst+"."+dcSecond));
|
|
|
LdapContext ldapContext = null;
|
|
|
Hashtable<String, Object> env = new Hashtable<String, Object>();
|
|
|
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
|
|
@@ -361,7 +356,7 @@ public class UserController {
|
|
|
//用户名称,cn,ou,dc 分别:用户,组,域
|
|
|
env.put(Context.SECURITY_PRINCIPAL, username+"@"+dcFirst+"."+dcSecond);
|
|
|
//用户密码 cn 的密码
|
|
|
- env.put(Context.SECURITY_CREDENTIALS, passWord);
|
|
|
+ env.put(Context.SECURITY_CREDENTIALS, password);
|
|
|
//url 格式:协议://ip:端口/组,域 ,直接连接到域或者组上面
|
|
|
env.put(Context.PROVIDER_URL,ldapUrl);
|
|
|
// //协议
|