|
@@ -10,6 +10,9 @@ package com.agent.controller.system; |
|
@@ -10,6 +10,9 @@ 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.framework.util.PropertiesLoader;
|
|
|
15
|
+import com.framework.util.StringUtils;
|
13
|
import org.apache.shiro.SecurityUtils;
|
16
|
import org.apache.shiro.SecurityUtils;
|
14
|
import org.apache.shiro.authc.IncorrectCredentialsException;
|
17
|
import org.apache.shiro.authc.IncorrectCredentialsException;
|
15
|
import org.apache.shiro.authc.LockedAccountException;
|
18
|
import org.apache.shiro.authc.LockedAccountException;
|
|
@@ -18,6 +21,7 @@ import org.apache.shiro.authc.UsernamePasswordToken; |
|
@@ -18,6 +21,7 @@ import org.apache.shiro.authc.UsernamePasswordToken; |
18
|
import org.apache.shiro.subject.Subject;
|
21
|
import org.apache.shiro.subject.Subject;
|
19
|
import org.springframework.stereotype.Controller;
|
22
|
import org.springframework.stereotype.Controller;
|
20
|
import org.springframework.transaction.annotation.Transactional;
|
23
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
24
|
+import org.springframework.web.bind.annotation.RequestBody;
|
21
|
import org.springframework.web.bind.annotation.RequestMapping;
|
25
|
import org.springframework.web.bind.annotation.RequestMapping;
|
22
|
import org.springframework.web.bind.annotation.RequestMethod;
|
26
|
import org.springframework.web.bind.annotation.RequestMethod;
|
23
|
import org.springframework.web.bind.annotation.ResponseBody;
|
27
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
@@ -39,6 +43,8 @@ import com.framework.util.MD5Tools; |
|
@@ -39,6 +43,8 @@ import com.framework.util.MD5Tools; |
39
|
import login.FLogin;
|
43
|
import login.FLogin;
|
40
|
import login.LoginData;
|
44
|
import login.LoginData;
|
41
|
|
45
|
|
|
|
46
|
+import java.util.Map;
|
|
|
47
|
+
|
42
|
@Controller
|
48
|
@Controller
|
43
|
public class LoginController {
|
49
|
public class LoginController {
|
44
|
|
50
|
|
|
@@ -144,13 +150,14 @@ public class LoginController { |
|
@@ -144,13 +150,14 @@ public class LoginController { |
144
|
@RequestMapping(value = "/doLogin", method = RequestMethod.POST)
|
150
|
@RequestMapping(value = "/doLogin", method = RequestMethod.POST)
|
145
|
@ResponseBody
|
151
|
@ResponseBody
|
146
|
public ResponseModel doLogin(String loginAccount, String password, String captcha) {
|
152
|
public ResponseModel doLogin(String loginAccount, String password, String captcha) {
|
|
|
153
|
+
|
147
|
SessionUtil.putKey(Constants.CAPTCHA, "");
|
154
|
SessionUtil.putKey(Constants.CAPTCHA, "");
|
148
|
ResponseModel rm = new ResponseModel(200, "", null);
|
155
|
ResponseModel rm = new ResponseModel(200, "", null);
|
149
|
|
156
|
|
150
|
UserEntity user = new UserEntity();
|
157
|
UserEntity user = new UserEntity();
|
151
|
user.setLoginaccount(loginAccount);
|
158
|
user.setLoginaccount(loginAccount);
|
152
|
user.setPassword(password);
|
159
|
user.setPassword(password);
|
153
|
- if (!loginAccount.equals("admin")) {
|
160
|
+ if (!loginAccount.equals("admin") && loginAccount.equals(PropertiesLoader.getLogin("openRemoteLogin"))) {
|
154
|
// 远程登录
|
161
|
// 远程登录
|
155
|
// 用户数据
|
162
|
// 用户数据
|
156
|
LoginData login = FLogin.login(user);
|
163
|
LoginData login = FLogin.login(user);
|
|
@@ -224,20 +231,21 @@ public class LoginController { |
|
@@ -224,20 +231,21 @@ public class LoginController { |
224
|
rm.setStatus(500);
|
231
|
rm.setStatus(500);
|
225
|
rm.setMsg("1");
|
232
|
rm.setMsg("1");
|
226
|
} catch (IncorrectCredentialsException e) {
|
233
|
} catch (IncorrectCredentialsException e) {
|
227
|
- rm.setStatus(500);
|
|
|
228
|
- rm.setMsg("1");
|
|
|
229
|
- } catch (LockedAccountException e) {
|
|
|
230
|
- rm.setStatus(500);
|
|
|
231
|
- rm.setMsg("1");
|
|
|
232
|
- }
|
234
|
+ rm.setStatus(500);
|
|
|
235
|
+ rm.setMsg("1");
|
|
|
236
|
+ } catch (LockedAccountException e) {
|
|
|
237
|
+ rm.setStatus(500);
|
|
|
238
|
+ rm.setMsg("1");
|
233
|
}
|
239
|
}
|
|
|
240
|
+ }
|
234
|
|
241
|
|
235
|
return rm;
|
242
|
return rm;
|
236
|
}
|
243
|
}
|
237
|
-
|
244
|
+
|
|
|
245
|
+
|
238
|
/**
|
246
|
/**
|
239
|
* 登录操作api
|
247
|
* 登录操作api
|
240
|
- *
|
248
|
+ *
|
241
|
* @return
|
249
|
* @return
|
242
|
*/
|
250
|
*/
|
243
|
@RequestMapping(value = "/loginApi", method = RequestMethod.POST)
|
251
|
@RequestMapping(value = "/loginApi", method = RequestMethod.POST)
|