修改注释
This commit is contained in:
commit
63c2e4717b
@ -6,8 +6,8 @@ import { axios } from '@/utils/request'
|
||||
// 获取验证图片 以及token
|
||||
export function reqGet(data) {
|
||||
return axios({
|
||||
url: '/captcha/code',
|
||||
method: 'get',
|
||||
url: '/captcha/get',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@ -15,7 +15,7 @@ export function reqGet(data) {
|
||||
// 滑动或者点选验证
|
||||
export function reqCheck(data) {
|
||||
return axios({
|
||||
url: '/captcha/code/check',
|
||||
url: '/captcha/check',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
|
@ -204,19 +204,19 @@ export default {
|
||||
} = this
|
||||
|
||||
state.loginBtn = true
|
||||
|
||||
const validateFieldsKey = customActiveKey === 'tab1' ? ['account', 'password'] : ['mobile', 'captcha']
|
||||
if (this.tenantOpen) {
|
||||
validateFieldsKey.push('tenantCode')
|
||||
}
|
||||
validateFields(validateFieldsKey, { force: true }, (err, values) => {
|
||||
if (!err) {
|
||||
this.loginParams = values
|
||||
// 是否开启验证码
|
||||
if (this.captchaOpen) {
|
||||
this.$refs.verify.show()
|
||||
state.loginBtn = false
|
||||
return
|
||||
}
|
||||
if (!err) {
|
||||
const loginParams = { ...values }
|
||||
delete loginParams.account
|
||||
loginParams[!state.loginType ? 'email' : 'account'] = values.account
|
||||
|
@ -25,10 +25,8 @@ XiaoNuo采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注
|
||||
package com.cn.xiaonuo.sys.modular.auth.controller;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import com.anji.captcha.model.common.ResponseModel;
|
||||
import com.anji.captcha.model.vo.CaptchaVO;
|
||||
import com.anji.captcha.service.CaptchaService;
|
||||
import com.cn.xiaonuo.core.consts.CommonConstant;
|
||||
import com.cn.xiaonuo.core.context.constant.ConstantContextHolder;
|
||||
import com.cn.xiaonuo.core.context.login.LoginContextHolder;
|
||||
import com.cn.xiaonuo.core.exception.AuthException;
|
||||
@ -120,46 +118,23 @@ public class SysLoginController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码开关
|
||||
*
|
||||
* @Description 获取验证码开关
|
||||
* @author Jax
|
||||
* @Date 2021/1/21 15:19
|
||||
*/
|
||||
* @return ResponseData
|
||||
**/
|
||||
@GetMapping("/getCaptchaOpen")
|
||||
public ResponseData getCaptchaOpen() {
|
||||
return new SuccessResponseData(ConstantContextHolder.getCaptchaOpenFlag());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*
|
||||
* @Description 校验验证码
|
||||
* @Date 2021/1/21 15:27
|
||||
* @author Jax
|
||||
* @Date 2021/1/21 15:19
|
||||
*/
|
||||
@GetMapping("/captcha/code")
|
||||
public ResponseModel getCode() {
|
||||
CaptchaVO vo = new CaptchaVO();
|
||||
vo.setCaptchaType(CommonConstant.IMAGE_CODE_TYPE);
|
||||
return captchaService.get(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验前端验证码
|
||||
*
|
||||
* @author Jax
|
||||
* @Date 2021/1/21 15:19
|
||||
*/
|
||||
@PostMapping("/captcha/code/check")
|
||||
public ResponseModel check(@RequestBody CaptchaVO captcha) {
|
||||
return captchaService.check(captcha);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
* @author Jax
|
||||
* @Date 2021/1/21 15:19
|
||||
*/
|
||||
* @param code
|
||||
* @return boolean
|
||||
**/
|
||||
private boolean verificationCode(String code) {
|
||||
CaptchaVO vo = new CaptchaVO();
|
||||
vo.setCaptchaVerification(code);
|
||||
|
@ -3,16 +3,17 @@ package com.cn.xiaonuo.sys.provider;
|
||||
import com.anji.captcha.service.CaptchaCacheService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 对于分布式部署的应用,我们建议应用自己实现CaptchaCacheService,比如用Redis
|
||||
* @ClassName CaptchaCacheServiceProvider
|
||||
* @Description 对于分布式部署的应用,我们建议应用自己实现CaptchaCacheService,比如用Redis
|
||||
* 如果应用是单点的,也没有使用redis,那默认使用内存。内存缓存只适合单节点部署的应用,否则验证码生产与验证在节点之间信息不同步,导致失败
|
||||
*
|
||||
* @Author Jax
|
||||
* @Date 2021/1/21 16:27
|
||||
*/
|
||||
/*public class CaptchaCacheServiceProvider implements CaptchaCacheService {
|
||||
**/
|
||||
public class CaptchaCacheServiceProvider implements CaptchaCacheService {
|
||||
|
||||
private static final String REDIS = "redis";
|
||||
|
||||
@ -44,4 +45,4 @@ import java.util.concurrent.TimeUnit;
|
||||
return REDIS;
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
|
@ -59,5 +59,6 @@ jodconverter:
|
||||
#验证码相关配置
|
||||
aj:
|
||||
captcha:
|
||||
type: clickword #验证码类型 为点选
|
||||
cache-type: local #分布式部署需要 自己实现CaptchaCacheService 使用redis需要配置redis相关配置
|
||||
type: clickword #验证码类型 为点选 blockPuzzle 为滑块验证码
|
||||
font-type: 宋体
|
||||
|
Loading…
x
Reference in New Issue
Block a user