提交 e2d2c4ee 编写于 作者:  Peijun.zhao's avatar Peijun.zhao

Merge branch 'dev-login-20200323' into 'release'

Dev login 20200323

reviewCoder by zhaopeijun

See merge request !20
流水线 #24221 已失败 于阶段
in 0 second
......@@ -60,10 +60,10 @@ public class AutoCodeController extends AccountBaseController {
private PropertiesConfiguration propertiesConfiguration;
@GetMapping("/ip")
/*@GetMapping("/ip")
public PicaResponse getIp(HttpServletRequest request) {
return PicaResponse.toResponse(IPUtil.getIpAdrress(request));
}
}*/
/*@ApiOperation("数据加密-方便测试")
@PostMapping("/encryptedParams")
......@@ -132,7 +132,9 @@ public class AutoCodeController extends AccountBaseController {
// 验证码类型 0默认 1注册 2微信登录绑定手机 3修改手机
// 4重置密码 5忘记密码 7患者招募提交问卷(效验) 8Appe登录绑定手机
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setSourceType(super.getSourceType());
if (super.getSourceType() != null) {
request.setSourceType(super.getSourceType());
}
AccountUtils.checkMobilePhone(request.getMobile());
// 拼图验证
......@@ -162,7 +164,9 @@ public class AutoCodeController extends AccountBaseController {
public PicaResponse<String> getAuthCodeWithCaptcha(@RequestBody EncryptEntity entity,
HttpServletRequest req) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setSourceType(super.getSourceType());
if (super.getSourceType() != null) {
request.setSourceType(super.getSourceType());
}
String mobilePhone = request.getMobile();
String flag = request.getFlag() + "";
String captchaToken = request.getCaptchaToken();
......
......@@ -49,9 +49,9 @@ public class BaseRequest {
@ApiModelProperty("capCode")
private String capCode;
@ApiModelProperty("滑动图片的x位置")
private int xPos;
private Integer xPos;
@ApiModelProperty("h5端适配缩放后背景图实际宽度")
private int imageW;
private Integer imageW;
public String getCaptchaToken() {
return captchaToken;
......@@ -221,19 +221,19 @@ public class BaseRequest {
this.capCode = capCode;
}
public int getxPos() {
public Integer getxPos() {
return xPos;
}
public void setxPos(int xPos) {
public void setxPos(Integer xPos) {
this.xPos = xPos;
}
public int getImageW() {
public Integer getImageW() {
return imageW;
}
public void setImageW(int imageW) {
public void setImageW(Integer imageW) {
this.imageW = imageW;
}
}
......@@ -13,7 +13,7 @@ public class OneClickLoginReq {
private String loginIp;
private int productType;
private Integer productType = 0;
public String getLoginIp() {
return loginIp;
......@@ -23,11 +23,11 @@ public class OneClickLoginReq {
this.loginIp = loginIp;
}
public int getProductType() {
public Integer getProductType() {
return productType;
}
public void setProductType(int productType) {
public void setProductType(Integer productType) {
this.productType = productType;
}
......
......@@ -232,7 +232,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
return -1;
}
String capCode = paramReq.getCapCode();
int xPos = paramReq.getxPos();
int xPos = paramReq.getxPos() == null ? 0 : paramReq.getxPos();
if (StringUtils.isEmpty(capCode) || xPos <= 0) {
String key = Constants.JIGSAW_CODE_KEY.replace("{mobile}", paramReq.getMobile());
Long count = cacheClient.decr(key);
......@@ -249,7 +249,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
SliderImageRequest req = new SliderImageRequest();
req.setCapcode(capCode);
req.setXpos(xPos);
req.setClientBackImageWidth(paramReq.getImageW());
req.setClientBackImageWidth(paramReq.getImageW() == null ? 1 : paramReq.getImageW());
resp = sliderImageService.checkcapcode(req);
logger.info("validateJigsawCode-resp:{}", JSON.toJSONString(resp));
} catch (Exception e) {
......
// Copyright 2016-2101 Pica.
package com.pica.cloud.account.account.server.mapper;
import com.alibaba.fastjson.JSON;
import com.pica.cloud.account.account.server.controller.AutoCodeController;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.RSAUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* @ClassName AutoCodeControllerTest
* @Description
* @Author Chongwen.jiang
* @Date 2020/4/3 14:31
* @ModifyDate 2020/4/3 14:31
* @Version 1.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class AutoCodeControllerTest {
/*@Autowired
private AutoCodeController autoCodeController;
@Test
public void getH5AuthCodeTest() throws Exception {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest request = servletRequestAttributes.getRequest();
String publicKey = "1234567890123456";
BaseRequest req= new BaseRequest();
req.setFlag(4);
req.setMobile("13517477655");
req.setCapCode(String.valueOf(System.currentTimeMillis()));
req.setxPos(126);
req.setDevice_token("000000");
req.setSourceType(4);
String content = AESUtil.aesEncrypt(JSON.toJSONString(req), publicKey);
String encryptKey = RSAUtil.encrypt(publicKey);
EncryptEntity entity = new EncryptEntity();
entity.setKey(encryptKey);
entity.setContent(content);
autoCodeController.getH5AuthCode(entity, request);
}*/
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册