|
@@ -78,7 +78,9 @@ import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.net.URLDecoder;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneOffset;
|
|
@@ -696,7 +698,7 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
return new Ajax();
|
|
|
}
|
|
|
|
|
|
- @RequestMapping("/std/stdRegInfo/reg")
|
|
|
+ /*@RequestMapping("/std/stdRegInfo/reg")
|
|
|
public Ajax reg(StdRegInfo stdRegInfo) {
|
|
|
if(null == stdRegInfo || StringUtils.isEmpty(stdRegInfo.getCert_no())){
|
|
|
throw new BusinessException("请填写证件号。");
|
|
@@ -792,11 +794,27 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
stdRegInfo.setPhoto_path(null);
|
|
|
stdRegInfo.setMajor_id(null);
|
|
|
|
|
|
+
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setCert_no(stdRegInfo.getCert_no());
|
|
|
+ std.setStd_name(stdRegInfo.getStd_name());
|
|
|
+ std.setStd_sex(stdRegInfo.getStd_sex());
|
|
|
+ std.setStd_city(stdRegInfo.getStd_city());
|
|
|
+ std.setStd_county(stdRegInfo.getStd_county());
|
|
|
+ std.setStd_birth(stdRegInfo.getStd_birth());
|
|
|
+ std.setCert_type(stdRegInfo.getCert_type());
|
|
|
+ std.setStd_pass(stdRegInfo.getStd_pass());
|
|
|
+ std.setStatus(StdConst.Status.NEW.ordinal());
|
|
|
+ std.setReg_time(DateHelper.format(now));
|
|
|
+ std.setIs_new_stu(1);
|
|
|
+ std.setStd_source(1);
|
|
|
+ std.setExam_time_id(exam_time_id);
|
|
|
+
|
|
|
// 保存考生信息
|
|
|
- this.stdRegInfoService.save(stdRegInfo);
|
|
|
+ this.stdRegInfoService.save(std);
|
|
|
|
|
|
return new Ajax();
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -3096,7 +3114,8 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
std = new StdRegInfo();
|
|
|
std.setId(dbStdRegInfo.getId());
|
|
|
std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
- std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+ // 返回加密后的手机号码
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone_en());
|
|
|
if(null != dbStdRegInfo.getQuestion()){
|
|
|
std.setQuestion("Question");
|
|
|
}
|
|
@@ -4579,6 +4598,14 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
if (null == stdRegInfo || StringUtils.isEmpty(stdRegInfo.getStd_name())) {
|
|
|
throw new BusinessException("请填写姓名。");
|
|
|
} else if (!StringUtils.isEmpty(stdRegInfo.getStd_name())) {
|
|
|
+ if(stdRegInfo.getStd_name().length()>15){
|
|
|
+ try {
|
|
|
+ stdRegInfo.setStd_name(URLDecoder.decode(stdRegInfo.getStd_name(),"utf-8"));
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ LogHelper.error(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (!PatternUtil.checkStdName(stdRegInfo.getStd_name().trim())) {
|
|
|
throw new BusinessException("请输入正确中文姓名且长度在15个字范围内!");
|
|
|
}
|
|
@@ -4697,8 +4724,30 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
stdRegInfo.setPhoto_path(null);
|
|
|
stdRegInfo.setMajor_id(null);
|
|
|
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setCert_no(stdRegInfo.getCert_no());
|
|
|
+ std.setStd_name(stdRegInfo.getStd_name());
|
|
|
+ std.setStd_sex(stdRegInfo.getStd_sex());
|
|
|
+ std.setStd_city(stdRegInfo.getStd_city());
|
|
|
+ std.setStd_county(stdRegInfo.getStd_county());
|
|
|
+ std.setStd_birth(stdRegInfo.getStd_birth());
|
|
|
+ std.setCert_type(stdRegInfo.getCert_type());
|
|
|
+ std.setStd_pass(stdRegInfo.getStd_pass());
|
|
|
+
|
|
|
+ //APP登录同时绑定手要号码
|
|
|
+ std.setStd_mobile(stdRegInfo.getStd_mobile());
|
|
|
+ std.setBindphone(stdRegInfo.getStd_mobile());
|
|
|
+
|
|
|
+ std.setStatus(StdConst.Status.NEW.ordinal());
|
|
|
+ std.setReg_time(DateHelper.format(now));
|
|
|
+ std.setIs_new_stu(1);
|
|
|
+ std.setStd_source(1);
|
|
|
+ std.setExam_time_id(exam_time_id);
|
|
|
+ std.setYear_code(currentTime.getYear_code());
|
|
|
+
|
|
|
+
|
|
|
// 保存考生信息
|
|
|
- this.stdRegInfoService.save(stdRegInfo);
|
|
|
+ this.stdRegInfoService.save(std);
|
|
|
|
|
|
return new Ajax();
|
|
|
|
|
@@ -4813,7 +4862,12 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
@RequestMapping("/std/getLoginToken")
|
|
|
public Ajax getLoginToken(String uuid) {
|
|
|
StdRegInfo std = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
- String token=SecureHelper.des3Encrypt(std.getId().toString()+ "@"+uuid+ "@"+ LocalDateTime.now().plusDays(7).toInstant(ZoneOffset.of("+8")).toEpochMilli(), SecureHelper.getSecureKey(uuid));
|
|
|
+ String loginToken = std.getId().toString()+ "@"+uuid+ "@"+ LocalDateTime.now().plusDays(7).toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
+ String pubKey = SysConst.getAppConfig().getPubKey();
|
|
|
+ // 4.1.7[高风险]敏感信息泄露
|
|
|
+ String token = RSAUtils.encrypt(loginToken, pubKey);
|
|
|
+
|
|
|
+ //String token=SecureHelper.des3Encrypt();
|
|
|
|
|
|
//[高风险]安全退出无效-服务端 将token保存数据库中
|
|
|
StdAppLogintoken temp = this.stdAppLogintokenDao.find("token", token);
|
|
@@ -4831,6 +4885,66 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
|
|
|
return new Ajax(token);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/std/setAuthentication")
|
|
|
+ public Ajax setAuthentication(String uuid, String token) {
|
|
|
+ if (uuid == null || token == null) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+// String std_id = SecureHelper.des3Decrypt(token, SecureHelper.getSecureKey(uuid));
|
|
|
+// if (StringUtils.isEmpty(std_id) ) {
|
|
|
+// throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+// }
|
|
|
+ String source = null;
|
|
|
+
|
|
|
+ /*try {
|
|
|
+ source = SecureHelper.des3Decrypt(token, SecureHelper.getSecureKey(uuid));
|
|
|
+ } catch (Exception e) {
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 4.1.7[高风险]敏感信息泄露
|
|
|
+ String privateKey = SysConst.getAppConfig().getPrivateKey();
|
|
|
+ source = RSAUtils.decrypt(token, privateKey);
|
|
|
+
|
|
|
+ if (StringHelper.isEmpty(source))
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ if (source.split("@").length != 3)
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ if (!source.split("@")[1].equals(uuid))
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ if(System.currentTimeMillis()>Long.parseLong(source.split("@")[2]))
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+
|
|
|
+ // [高风险]安全退出无效-服务端 从数据库中获取token,判断token是否已经安全退出,如果已经安全退出,则需要重新登录
|
|
|
+ StdAppLogintoken temp = this.stdAppLogintokenDao.find("token", token);
|
|
|
+ if (null != temp && !"1".equals(temp.getStatus())) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoDao.queryStdById(Integer.valueOf(source.split("@")[0]));
|
|
|
+ if (dbStdRegInfo == null ) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ StdRegInfo seStd = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (seStd != null && !seStd.getId().equals(dbStdRegInfo.getId())) {
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ throw new BusinessException("请注销之前的登录用户或关闭浏览器重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+
|
|
|
+ String pubKey = SysConst.getAppConfig().getPubKey();
|
|
|
+ String std_pass = dbStdRegInfo.getStd_pass();
|
|
|
+ String encrypt_std_pass = RSAUtils.encrypt(std_pass, pubKey);
|
|
|
+ std.setStd_pass(encrypt_std_pass);
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ }
|
|
|
|
|
|
@RequestMapping("/std/loginForAuthentication")
|
|
|
public Ajax loginForAuthentication(String uuid, String token) {
|
|
@@ -4843,10 +4957,16 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
// throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
// }
|
|
|
String source = null;
|
|
|
- try {
|
|
|
+
|
|
|
+ /*try {
|
|
|
source = SecureHelper.des3Decrypt(token, SecureHelper.getSecureKey(uuid));
|
|
|
} catch (Exception e) {
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 4.1.7[高风险]敏感信息泄露
|
|
|
+ String privateKey = SysConst.getAppConfig().getPrivateKey();
|
|
|
+ source = RSAUtils.decrypt(token, privateKey);
|
|
|
+
|
|
|
if (StringHelper.isEmpty(source))
|
|
|
throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
if (source.split("@").length != 3)
|
|
@@ -4870,6 +4990,7 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
|
|
|
StdRegInfo seStd = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
if (seStd != null && !seStd.getId().equals(dbStdRegInfo.getId())) {
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
throw new BusinessException("请注销之前的登录用户或关闭浏览器重新登录!");
|
|
|
}
|
|
|
stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
@@ -4883,5 +5004,61 @@ public class StdRegInfoControl extends AjaxControl {
|
|
|
return new Ajax(std);
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping("/std/loginForAuthenticationMode")
|
|
|
+ public Ajax loginForAuthenticationMode(Integer id, String std_pass) {
|
|
|
+ if (id == null || std_pass == null) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+// String std_id = SecureHelper.des3Decrypt(token, SecureHelper.getSecureKey(uuid));
|
|
|
+// if (StringUtils.isEmpty(std_id) ) {
|
|
|
+// throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+// }
|
|
|
+ String source = null;
|
|
|
+
|
|
|
+ /*try {
|
|
|
+ source = SecureHelper.des3Decrypt(token, SecureHelper.getSecureKey(uuid));
|
|
|
+ } catch (Exception e) {
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 4.1.7[高风险]敏感信息泄露
|
|
|
+ String privateKey = SysConst.getAppConfig().getPrivateKey();
|
|
|
+ source = RSAUtils.decrypt(std_pass, privateKey);
|
|
|
+
|
|
|
+
|
|
|
+ StdRegInfo dbStdRegInfo = this.stdRegInfoDao.queryStdById(id);
|
|
|
+ if (dbStdRegInfo == null) {
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ String error = this.isSysOperateFail(dbStdRegInfo.getCert_no(), "canLoginTime", 5);
|
|
|
+ if (null != error) {
|
|
|
+ throw new BusinessException(error);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(!dbStdRegInfo.getStd_pass().equals(source)){
|
|
|
+ this.setSysOperateFail(dbStdRegInfo.getCert_no(), "canLoginTime", 5, 5, "登录失败累计超过5次,请5分钟之后再登录!");
|
|
|
+ throw new BusinessException("请使用账号或手机重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ StdRegInfo seStd = (StdRegInfo) getRequest().getSession().getAttribute(EnrolSessionName.EnrolStdReg);
|
|
|
+ if (seStd != null && !seStd.getId().equals(dbStdRegInfo.getId())) {
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, null);
|
|
|
+ throw new BusinessException("请注销之前的登录用户或关闭浏览器重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ stdRegInfoService.DecryptStd(dbStdRegInfo);
|
|
|
+ getRequest().getSession().setAttribute(EnrolSessionName.EnrolStdReg, dbStdRegInfo);
|
|
|
+ StdRegInfo std = new StdRegInfo();
|
|
|
+ std.setId(dbStdRegInfo.getId());
|
|
|
+ std.setTicket_no(dbStdRegInfo.getTicket_no());
|
|
|
+ std.setBindphone(dbStdRegInfo.getBindphone());
|
|
|
+
|
|
|
+ return new Ajax(std);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|