|
|
|
@ -1741,4 +1741,89 @@ public class CollectController extends Controller {
|
|
|
|
|
List<Record> list = cm.getSchoolNjList(bureau_id);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:填报系统专用登录接口,后期可以扩展支持天喻平台对接
|
|
|
|
|
* @param username
|
|
|
|
|
* @param password
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
public void doFillLogin(String username, String password) {
|
|
|
|
|
JSONObject resultJson = new JSONObject();
|
|
|
|
|
String checkCodeKey = "";
|
|
|
|
|
|
|
|
|
|
if (StrKit.isBlank(username)) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名不允许为空!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (StrKit.isBlank(password)) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "密码不允许为空!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检查缓存中此账号错误了几次
|
|
|
|
|
String PassWordKey = "WrongPassWord_" + username;
|
|
|
|
|
int ErrCnt = 4; //最多允许错几次 4+1
|
|
|
|
|
int cntNum = 0; //错几次了
|
|
|
|
|
|
|
|
|
|
if (RedisKit.Exists(PassWordKey))
|
|
|
|
|
cntNum = Integer.parseInt(RedisKit.Get(PassWordKey));
|
|
|
|
|
if (cntNum > ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "账号被停用5分钟,请稍后再试!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//与前端配合RSA通用加密解密
|
|
|
|
|
try {
|
|
|
|
|
password = RsaUtils.decryptDataOnJava(password, RsaUtils.PRIVATEKEY);
|
|
|
|
|
} catch (Exception err) {
|
|
|
|
|
password = "!@#$%^&&*^*&(*)(*_)^%^$%$^%$^%";
|
|
|
|
|
}
|
|
|
|
|
String passwordEncode = CommonUtil.getLdapPassword(password);
|
|
|
|
|
BaseModel bm = new BaseModel();
|
|
|
|
|
Map loginMap = bm.getLoginInfoByUserName(username);
|
|
|
|
|
if (loginMap == null || !passwordEncode.equals(loginMap.get("password").toString())) {
|
|
|
|
|
//扩展支持连续输入用户名密码错误,停用账号5分钟功能 2022.06.07
|
|
|
|
|
cntNum = 1;
|
|
|
|
|
if (RedisKit.Exists(PassWordKey))
|
|
|
|
|
cntNum = Integer.parseInt(RedisKit.Get(PassWordKey)) + cntNum;
|
|
|
|
|
|
|
|
|
|
int finalCntNum = cntNum;
|
|
|
|
|
RedisKit.incrBy(PassWordKey, finalCntNum);
|
|
|
|
|
RedisKit.Expire(PassWordKey, 60 * 5);
|
|
|
|
|
if (cntNum > ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "密码连续输入" + (ErrCnt + 1) + "次全部错误,账号将被停用5分钟!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (cntNum == ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名或密码连续错误,你还有1次机会,再次错误后账号将被封掉5分钟!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名或密码错误!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//去掉限制
|
|
|
|
|
RedisKit.Del(PassWordKey);
|
|
|
|
|
RedisKit.Del(checkCodeKey);
|
|
|
|
|
//防止用户攻击修改Cookie
|
|
|
|
|
Map<String, Object> _map = new HashMap<>();
|
|
|
|
|
_map.put("person_id", loginMap.get("person_id"));
|
|
|
|
|
|
|
|
|
|
SessionKit.set(getRequest(), getResponse(), "person_id", loginMap.get("person_id").toString());
|
|
|
|
|
resultJson.put("success", true);
|
|
|
|
|
resultJson.put("person_id", loginMap.get("person_id").toString());
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|