mirror of
https://gitee.com/mmsAdmin/mms
synced 2025-12-08 01:48:24 +08:00
验证码开启升级
This commit is contained in:
parent
684039cc20
commit
7df50a2d1c
@ -9,6 +9,7 @@ import com.sxpcwlkj.common.code.entity.CaptchaEntity;
|
|||||||
import com.sxpcwlkj.common.code.entity.ConfigEntity;
|
import com.sxpcwlkj.common.code.entity.ConfigEntity;
|
||||||
import com.sxpcwlkj.common.constant.Constants;
|
import com.sxpcwlkj.common.constant.Constants;
|
||||||
import com.sxpcwlkj.common.enums.ConfigKeyNum;
|
import com.sxpcwlkj.common.enums.ConfigKeyNum;
|
||||||
|
import com.sxpcwlkj.common.enums.SystemCommonEnum;
|
||||||
import com.sxpcwlkj.common.properties.CaptchaProperties;
|
import com.sxpcwlkj.common.properties.CaptchaProperties;
|
||||||
import com.sxpcwlkj.common.utils.DataUtil;
|
import com.sxpcwlkj.common.utils.DataUtil;
|
||||||
import com.sxpcwlkj.redis.RedisUtil;
|
import com.sxpcwlkj.redis.RedisUtil;
|
||||||
@ -22,6 +23,7 @@ import java.time.Duration;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -45,12 +47,12 @@ public class CaptchaServiceImpl implements CaptchaService {
|
|||||||
}
|
}
|
||||||
convert.forEach(smsConfigEntity -> {
|
convert.forEach(smsConfigEntity -> {
|
||||||
if("sys_base_captcha_state".equals(smsConfigEntity.getConfigKey())){
|
if("sys_base_captcha_state".equals(smsConfigEntity.getConfigKey())){
|
||||||
if(Convert.toInt(smsConfigEntity.getConfigValue()) == 1){
|
if(Objects.equals(Convert.toInt(smsConfigEntity.getConfigValue()), SystemCommonEnum.SYS_COMMON_STATE_OPEN.getValue())){
|
||||||
isOpen.set(true);
|
isOpen.set(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!captchaProperties.isStatus()||!isOpen.get()) {
|
if (!isOpen.get()) {
|
||||||
data.put(CaptchaEntity.CODE.CAPTCHA_MSG.getValue(), "系统验证码未开启!");
|
data.put(CaptchaEntity.CODE.CAPTCHA_MSG.getValue(), "系统验证码未开启!");
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
--- # 项目基础信息
|
|
||||||
sxpcwlkj:
|
|
||||||
# 开启验证码: true:开启 false: 关闭
|
|
||||||
isOpenCaptcha: false
|
|
||||||
|
|
||||||
--- # powerjob 配置
|
--- # powerjob 配置
|
||||||
powerjob:
|
powerjob:
|
||||||
worker:
|
worker:
|
||||||
@ -10,7 +5,6 @@ powerjob:
|
|||||||
enabled: false
|
enabled: false
|
||||||
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
||||||
app-name: mms
|
app-name: mms
|
||||||
enable-test-mode: false
|
|
||||||
max-appended-wf-context-length: 4096
|
max-appended-wf-context-length: 4096
|
||||||
max-result-length: 4096
|
max-result-length: 4096
|
||||||
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
||||||
@ -44,42 +38,45 @@ spring:
|
|||||||
primary: master
|
primary: master
|
||||||
# 严格模式 匹配不到数据源则报错
|
# 严格模式 匹配不到数据源则报错
|
||||||
strict: true
|
strict: true
|
||||||
|
public-key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJssgtfcBfc+d8Et0FBGQRBonRRQBD8jB1UHTRbk3diOliGlec9lJxbGR/qp7Jp8uYozCr96lvpnIIJM59fNoeUCAwEAAQ==
|
||||||
|
# 账号密码
|
||||||
datasource:
|
datasource:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
type: ${spring.datasource.type}
|
type: ${spring.datasource.type}
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
url: jdbc:mysql://119.28.10.247:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
||||||
username: root
|
username: mms
|
||||||
password: 123456
|
# 由GeneratePassword.java 生成, public-key 和 password 要匹配
|
||||||
# 从库数据源
|
password: ENC(c6FYwkk1dtKxfAcOED4g4mAgzCoK6XTr6+VTXVfQYly9I02yiND8aK5vTeYJ+oJCGH4beQyZLl9H2kt1ZCXqJg==)
|
||||||
slave:
|
# # 从库数据源
|
||||||
lazy: true
|
# slave:
|
||||||
type: ${spring.datasource.type}
|
# lazy: true
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
# type: ${spring.datasource.type}
|
||||||
url: jdbc:mysql://localhost:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
# driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
# url: jdbc:mysql://localhost:3306/mms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
||||||
password: 123456
|
# username: root
|
||||||
# oracle:
|
# password: 123456
|
||||||
# type: ${spring.datasource.type}
|
# oracle:
|
||||||
# driverClassName: oracle.jdbc.OracleDriver
|
# type: ${spring.datasource.type}
|
||||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
# driverClassName: oracle.jdbc.OracleDriver
|
||||||
# username: ROOT
|
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||||
# password: root
|
# username: ROOT
|
||||||
# hikari:
|
# password: root
|
||||||
# connectionTestQuery: SELECT 1 FROM DUAL
|
# hikari:
|
||||||
# postgres:
|
# connectionTestQuery: SELECT 1 FROM DUAL
|
||||||
# type: ${spring.datasource.type}
|
# postgres:
|
||||||
# driverClassName: org.postgresql.Driver
|
# type: ${spring.datasource.type}
|
||||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
# driverClassName: org.postgresql.Driver
|
||||||
# username: root
|
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||||
# password: root
|
# username: root
|
||||||
# sqlserver:
|
# password: root
|
||||||
# type: ${spring.datasource.type}
|
# sqlserver:
|
||||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
# type: ${spring.datasource.type}
|
||||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
# username: SA
|
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||||
# password: root
|
# username: SA
|
||||||
|
# password: root
|
||||||
hikari:
|
hikari:
|
||||||
# 最大连接池数量
|
# 最大连接池数量
|
||||||
maxPoolSize: 20
|
maxPoolSize: 20
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
--- # 项目基础信息
|
|
||||||
sxpcwlkj:
|
|
||||||
# 开启验证码: true:开启 false: 关闭
|
|
||||||
isOpenCaptcha: false
|
|
||||||
|
|
||||||
--- # powerjob 配置
|
--- # powerjob 配置
|
||||||
powerjob:
|
powerjob:
|
||||||
worker:
|
worker:
|
||||||
@ -43,8 +38,7 @@ spring:
|
|||||||
primary: master
|
primary: master
|
||||||
# 严格模式 匹配不到数据源则报错
|
# 严格模式 匹配不到数据源则报错
|
||||||
strict: true
|
strict: true
|
||||||
# 账号加密,公钥
|
# 账号密码
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
--- # 项目基础信息
|
|
||||||
sxpcwlkj:
|
|
||||||
# 开启验证码: true:开启 false: 关闭
|
|
||||||
isOpenCaptcha: true
|
|
||||||
|
|
||||||
--- # powerjob 配置
|
--- # powerjob 配置
|
||||||
powerjob:
|
powerjob:
|
||||||
worker:
|
worker:
|
||||||
@ -10,7 +5,6 @@ powerjob:
|
|||||||
enabled: false
|
enabled: false
|
||||||
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
||||||
app-name: mms
|
app-name: mms
|
||||||
enable-test-mode: false
|
|
||||||
max-appended-wf-context-length: 4096
|
max-appended-wf-context-length: 4096
|
||||||
max-result-length: 4096
|
max-result-length: 4096
|
||||||
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
||||||
|
|||||||
@ -12,8 +12,6 @@ sxpcwlkj:
|
|||||||
copyrightYear: 2018
|
copyrightYear: 2018
|
||||||
# 机构团队
|
# 机构团队
|
||||||
organization: 陕西品创网络
|
organization: 陕西品创网络
|
||||||
# 开启验证码: true:开启 false: 关闭
|
|
||||||
isOpenCaptcha: false
|
|
||||||
|
|
||||||
# 演示模式配置
|
# 演示模式配置
|
||||||
demo:
|
demo:
|
||||||
@ -23,12 +21,11 @@ demo:
|
|||||||
allowed-users: # 白名单用户
|
allowed-users: # 白名单用户
|
||||||
- admin
|
- admin
|
||||||
allowed-methods:
|
allowed-methods:
|
||||||
|
- initSign
|
||||||
- updateIpById
|
- updateIpById
|
||||||
|
|
||||||
--- # 验证码配置
|
--- # 验证码配置
|
||||||
captcha:
|
captcha:
|
||||||
# 是否开启验证码: true 开启 false 关闭
|
|
||||||
status: true
|
|
||||||
# 页面 <参数设置> 可开启关闭 验证码校验
|
# 页面 <参数设置> 可开启关闭 验证码校验
|
||||||
# 线段干扰 LINE 圆圈干扰 CIRCLE 扭曲干扰 SHEAR 计算题型 CALCULATE
|
# 线段干扰 LINE 圆圈干扰 CIRCLE 扭曲干扰 SHEAR 计算题型 CALCULATE
|
||||||
type: LINE
|
type: LINE
|
||||||
|
|||||||
@ -14,12 +14,6 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "captcha")
|
@ConfigurationProperties(prefix = "captcha")
|
||||||
public class CaptchaProperties {
|
public class CaptchaProperties {
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否开启验证码
|
|
||||||
*/
|
|
||||||
private boolean status;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码类型
|
* 验证码类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -33,8 +33,5 @@ public class MsProperties {
|
|||||||
* 机构组织
|
* 机构组织
|
||||||
*/
|
*/
|
||||||
private String organization;
|
private String organization;
|
||||||
/**
|
|
||||||
* 是否开启验证码
|
|
||||||
*/
|
|
||||||
private Boolean isOpenCaptcha;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user