1. 增加 yudao-spring-boot-starter-tenant 租户的组件

2. 改造 UserDO,接入多租户
This commit is contained in:
YunaiV
2021-12-04 21:09:49 +08:00
parent ccb56b3b99
commit 7c8fe2fc50
35 changed files with 426 additions and 15 deletions

View File

@@ -1,11 +1,12 @@
### 请求 /login 接口 => 成功
POST {{baseUrl}}/login
Content-Type: application/json
tenant-id: 0
{
"username": "admin",
"password": "admin123",
"uuid": "9b2ffbc1-7425-4155-9894-9d5c08541d62",
"uuid": "3acd87a09a4f48fb9118333780e94883",
"code": "1024"
}

View File

@@ -12,6 +12,13 @@ import java.time.Duration;
@Data
public class CaptchaProperties {
private static final Boolean ENABLE_DEFAULT = true;
/**
* 是否开启
* 注意,这里仅仅是后端 Server 是否校验,暂时不控制前端的逻辑
*/
private Boolean enable = ENABLE_DEFAULT;
/**
* 验证码的过期时间
*/

View File

@@ -133,9 +133,13 @@ public class SysAuthServiceImpl implements SysAuthService {
}
private void verifyCaptcha(String username, String captchaUUID, String captchaCode) {
// 如果验证码关闭,则不进行校验
if (!captchaService.isCaptchaEnable()) {
return;
}
// 验证码不存在
final SysLoginLogTypeEnum logTypeEnum = SysLoginLogTypeEnum.LOGIN_USERNAME;
String code = captchaService.getCaptchaCode(captchaUUID);
// 验证码不存在
if (code == null) {
// 创建登录失败日志(验证码不存在)
this.createLoginLog(username, logTypeEnum, SysLoginResultEnum.CAPTCHA_NOT_FOUND);

View File

@@ -14,6 +14,13 @@ public interface SysCaptchaService {
*/
SysCaptchaImageRespVO getCaptchaImage();
/**
* 是否开启图片验证码
*
* @return 是否
*/
Boolean isCaptchaEnable();
/**
* 获得 uuid 对应的验证码
*

View File

@@ -35,6 +35,11 @@ public class SysCaptchaServiceImpl implements SysCaptchaService {
return SysCaptchaConvert.INSTANCE.convert(uuid, captcha);
}
@Override
public Boolean isCaptchaEnable() {
return captchaProperties.getEnable();
}
@Override
public String getCaptchaCode(String uuid) {
return captchaRedisDAO.get(uuid);