|
@@ -46,7 +46,7 @@ public class UserServiceImpl implements UserService {
|
|
|
private UserUtil userUtil;
|
|
|
|
|
|
@Override
|
|
|
- public Result getCodeImage() {
|
|
|
+ public Result getCodeImage(boolean hasPubKey) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
// 定义图形验证码的长、宽、验证码字符数、干扰线宽度
|
|
|
ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(126, 40, 4, 4);
|
|
@@ -61,6 +61,9 @@ public class UserServiceImpl implements UserService {
|
|
|
redisUtil.set(sessionId + "-captcha", captchaCode, ConstantStr.ONE_MINUTE);
|
|
|
jsonObject.put("uid", sessionId);
|
|
|
jsonObject.put("verifyCode", captcha.getImageBase64());
|
|
|
+ if (hasPubKey) {
|
|
|
+ jsonObject.put("publicKey", RSAUtil.PUBLIC_KEY);
|
|
|
+ }
|
|
|
return Result.ok(jsonObject);
|
|
|
}
|
|
|
|