作者 申海龙

修改系统的登录流程

... ... @@ -10,6 +10,9 @@ package com.agent.controller.system;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.framework.util.PropertiesLoader;
import com.framework.util.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
... ... @@ -18,6 +21,7 @@ import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
... ... @@ -39,6 +43,8 @@ import com.framework.util.MD5Tools;
import login.FLogin;
import login.LoginData;
import java.util.Map;
@Controller
public class LoginController {
... ... @@ -144,13 +150,14 @@ public class LoginController {
@RequestMapping(value = "/doLogin", method = RequestMethod.POST)
@ResponseBody
public ResponseModel doLogin(String loginAccount, String password, String captcha) {
SessionUtil.putKey(Constants.CAPTCHA, "");
ResponseModel rm = new ResponseModel(200, "", null);
UserEntity user = new UserEntity();
user.setLoginaccount(loginAccount);
user.setPassword(password);
if (!loginAccount.equals("admin")) {
if (!loginAccount.equals("admin") && loginAccount.equals(PropertiesLoader.getLogin("openRemoteLogin"))) {
// 远程登录
// 用户数据
LoginData login = FLogin.login(user);
... ... @@ -235,6 +242,7 @@ public class LoginController {
return rm;
}
/**
* 登录操作api
*
... ...
... ... @@ -23,6 +23,8 @@ public class PropertiesLoader {
private static final String REDIS_FILE = "/redis.properties";
private static final String LOGIN_FILE = "/openRemoteLogin.properties";
/**
* 配置文件properties获取value
* @param key
... ... @@ -63,6 +65,12 @@ public class PropertiesLoader {
}
public static String getLogin(String key) {
Properties properties = PropertiesLoader.loadProperty(LOGIN_FILE);
return properties.getProperty(key);
}
public static String get(String key,String propertyFile){
Properties properties = loadProperty(propertyFile);
return (String) properties.get(key);
... ...
#ǷԶ̵¼
openRemoteLogin = true
\ No newline at end of file
... ...