| | |
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.google.code.kaptcha.Producer;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.sign.Base64;
|
| | | import com.ruoyi.common.utils.uuid.IdUtils;
|
| | |
| | | public AjaxResult getCode(HttpServletResponse response) throws IOException
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | boolean captchaOnOff = configService.selectCaptchaOnOff();
|
| | | ajax.put("captchaOnOff", captchaOnOff);
|
| | | if (!captchaOnOff)
|
| | | boolean captchaEnabled = configService.selectCaptchaEnabled();
|
| | | ajax.put("captchaEnabled", captchaEnabled);
|
| | | if (!captchaEnabled)
|
| | | {
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | // 保存验证码信息
|
| | | String uuid = IdUtils.simpleUUID();
|
| | | String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
| | |
|
| | | String capStr = null, code = null;
|
| | | BufferedImage image = null;
|