正在显示
2 个修改的文件
包含
16 行增加
和
37 行删除
@@ -10,6 +10,11 @@ package com.agent.controller.system; | @@ -10,6 +10,11 @@ package com.agent.controller.system; | ||
10 | import javax.annotation.Resource; | 10 | import javax.annotation.Resource; |
11 | import javax.servlet.http.HttpServletRequest; | 11 | import javax.servlet.http.HttpServletRequest; |
12 | 12 | ||
13 | + | ||
14 | +import com.agent.entity.system.FunctionEntity; | ||
15 | +import com.agent.vo.MenuVo; | ||
16 | +import com.framework.util.PropertiesLoader; | ||
17 | +import com.framework.util.StringUtils; | ||
13 | import org.apache.shiro.SecurityUtils; | 18 | import org.apache.shiro.SecurityUtils; |
14 | import org.apache.shiro.authc.IncorrectCredentialsException; | 19 | import org.apache.shiro.authc.IncorrectCredentialsException; |
15 | import org.apache.shiro.authc.LockedAccountException; | 20 | import org.apache.shiro.authc.LockedAccountException; |
@@ -18,6 +23,7 @@ import org.apache.shiro.authc.UsernamePasswordToken; | @@ -18,6 +23,7 @@ import org.apache.shiro.authc.UsernamePasswordToken; | ||
18 | import org.apache.shiro.subject.Subject; | 23 | import org.apache.shiro.subject.Subject; |
19 | import org.springframework.stereotype.Controller; | 24 | import org.springframework.stereotype.Controller; |
20 | import org.springframework.transaction.annotation.Transactional; | 25 | import org.springframework.transaction.annotation.Transactional; |
26 | +import org.springframework.web.bind.annotation.RequestBody; | ||
21 | import org.springframework.web.bind.annotation.RequestMapping; | 27 | import org.springframework.web.bind.annotation.RequestMapping; |
22 | import org.springframework.web.bind.annotation.RequestMethod; | 28 | import org.springframework.web.bind.annotation.RequestMethod; |
23 | import org.springframework.web.bind.annotation.ResponseBody; | 29 | import org.springframework.web.bind.annotation.ResponseBody; |
@@ -39,6 +45,9 @@ import com.framework.util.MD5Tools; | @@ -39,6 +45,9 @@ import com.framework.util.MD5Tools; | ||
39 | import login.FLogin; | 45 | import login.FLogin; |
40 | import login.LoginData; | 46 | import login.LoginData; |
41 | 47 | ||
48 | +import java.util.List; | ||
49 | +import java.util.Map; | ||
50 | + | ||
42 | @Controller | 51 | @Controller |
43 | public class LoginController { | 52 | public class LoginController { |
44 | 53 | ||
@@ -144,13 +153,15 @@ public class LoginController { | @@ -144,13 +153,15 @@ public class LoginController { | ||
144 | @RequestMapping(value = "/doLogin", method = RequestMethod.POST) | 153 | @RequestMapping(value = "/doLogin", method = RequestMethod.POST) |
145 | @ResponseBody | 154 | @ResponseBody |
146 | public ResponseModel doLogin(String loginAccount, String password, String captcha) { | 155 | public ResponseModel doLogin(String loginAccount, String password, String captcha) { |
156 | + | ||
147 | SessionUtil.putKey(Constants.CAPTCHA, ""); | 157 | SessionUtil.putKey(Constants.CAPTCHA, ""); |
148 | ResponseModel rm = new ResponseModel(200, "", null); | 158 | ResponseModel rm = new ResponseModel(200, "", null); |
149 | 159 | ||
150 | UserEntity user = new UserEntity(); | 160 | UserEntity user = new UserEntity(); |
151 | user.setLoginaccount(loginAccount); | 161 | user.setLoginaccount(loginAccount); |
152 | user.setPassword(password); | 162 | user.setPassword(password); |
153 | - if (!loginAccount.equals("admin")) { | 163 | + |
164 | + if (!loginAccount.equals("admin") && "true".equals(PropertiesLoader.getLogin("openRemoteLogin"))) { | ||
154 | // 远程登录 | 165 | // 远程登录 |
155 | // 用户数据 | 166 | // 用户数据 |
156 | LoginData login = FLogin.login(user); | 167 | LoginData login = FLogin.login(user); |
@@ -235,6 +246,7 @@ public class LoginController { | @@ -235,6 +246,7 @@ public class LoginController { | ||
235 | return rm; | 246 | return rm; |
236 | } | 247 | } |
237 | 248 | ||
249 | + | ||
238 | /** | 250 | /** |
239 | * 登录操作api | 251 | * 登录操作api |
240 | * | 252 | * |
@@ -262,41 +274,6 @@ public class LoginController { | @@ -262,41 +274,6 @@ public class LoginController { | ||
262 | UserEntity user = new UserEntity(); | 274 | UserEntity user = new UserEntity(); |
263 | user.setLoginaccount(j.get("appLoginID").toString()); | 275 | user.setLoginaccount(j.get("appLoginID").toString()); |
264 | user.setPassword(j.get("appLoginPass").toString()); | 276 | user.setPassword(j.get("appLoginPass").toString()); |
265 | - if (!j.get("appLoginID").toString().equals("admin")) {} | ||
266 | - // 远程登录 | ||
267 | - // 用户数据 | ||
268 | - LoginData login = FLogin.login(user); | ||
269 | - // 登录成功! | ||
270 | - if (login.getCode() == 20000) { | ||
271 | - // 往数据库中插入数据 | ||
272 | - UserEntity ue = userService.findByLoginaccount(user.getLoginaccount()); | ||
273 | - // 用户存在 | ||
274 | - if (ue != null) { | ||
275 | - // 修改密码 | ||
276 | - userService.updatePassword(ue.getLoginaccount(), MD5Tools.MD5(j.get("appLoginPass").toString())); | ||
277 | - } else { | ||
278 | - // 用户不存在,插入数据 | ||
279 | - BasicAgentEntity agent = new BasicAgentEntity(); | ||
280 | - agent.setContact(login.getInfodata().getContact()); | ||
281 | - agent.setNameCn(login.getInfodata().getCompany()); | ||
282 | - agent.setCountryCode("CN"); | ||
283 | - agent.setAddress(login.getInfodata().getAddress()); | ||
284 | - int agent_id = agentSerive.save2(agent); | ||
285 | - | ||
286 | - ue = new UserEntity(); | ||
287 | - ue.setLoginaccount(j.get("appLoginID").toString()); | ||
288 | - // 设置用户名密码 | ||
289 | - ue.setPassword(MD5Tools.MD5(j.get("appLoginPass").toString())); | ||
290 | - ue.setRealName(login.getInfodata().getContact()); | ||
291 | - ue.setMobile(login.getInfodata().getMobile()); | ||
292 | - ue.setStatus(0); | ||
293 | - ue.setAgent(new Long(agent_id)); | ||
294 | - RoleEntity re = new RoleEntity(); | ||
295 | - re.setId(new Long(1)); | ||
296 | - ue.setRole(re); | ||
297 | - // 删除密码 | ||
298 | - userService.save(ue); | ||
299 | - } | ||
300 | 277 | ||
301 | // 登录用户 | 278 | // 登录用户 |
302 | Subject subject = SecurityUtils.getSubject(); | 279 | Subject subject = SecurityUtils.getSubject(); |
@@ -326,7 +303,7 @@ public class LoginController { | @@ -326,7 +303,7 @@ public class LoginController { | ||
326 | } | 303 | } |
327 | } | 304 | } |
328 | 305 | ||
329 | - } | 306 | + |
330 | return "login"; | 307 | return "login"; |
331 | } | 308 | } |
332 | } | 309 | } |
-
请 注册 或 登录 后发表评论