增加验证码的开关的功能

This commit is contained in:
jishenghua
2025-09-21 16:31:03 +08:00
parent d3643c2a99
commit ca89353667
4 changed files with 49 additions and 18 deletions

View File

@@ -685,6 +685,7 @@ INSERT INTO `jsh_platform_config` VALUES ('18', 'bill_excel_url', '单据Excel
INSERT INTO `jsh_platform_config` VALUES ('19', 'email_from', '邮件发送端-发件人', '');
INSERT INTO `jsh_platform_config` VALUES ('20', 'email_auth_code', '邮件发送端-授权码', '');
INSERT INTO `jsh_platform_config` VALUES ('21', 'email_smtp_host', '邮件发送端-SMTP服务器', '');
INSERT INTO `jsh_platform_config` VALUES ('22', 'checkcode_flag', '验证码启用标记', '1');
-- ----------------------------
-- Table structure for jsh_role

View File

@@ -1699,3 +1699,10 @@ alter table jsh_material change other_field3 other_field3 varchar(500) DEFAULT N
insert into jsh_platform_config (platform_key, platform_key_info, platform_value) VALUES ('email_from', '邮件发送端-发件人', '');
insert into jsh_platform_config (platform_key, platform_key_info, platform_value) VALUES ('email_auth_code', '邮件发送端-授权码', '');
insert into jsh_platform_config (platform_key, platform_key_info, platform_value) VALUES ('email_smtp_host', '邮件发送端-SMTP服务器', '');
-- --------------------------------------------------------
-- 时间 2025年9月21日
-- by jishenghua
-- 给平台表增加验证码启用标记
-- --------------------------------------------------------
insert into jsh_platform_config(platform_key, platform_key_info, platform_value) values ('checkcode_flag', '验证码启用标记', '1');

View File

@@ -151,6 +151,26 @@ public class PlatformConfigController extends BaseController {
return res;
}
/**
* 获取是否开启验证码
* @param request
* @return
*/
@GetMapping(value = "/getPlatform/checkcodeFlag")
@ApiOperation(value = "获取是否开启验证码")
public String getPlatformCheckcodeFlag(HttpServletRequest request)throws Exception {
String res;
try {
String platformKey = "checkcode_flag";
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "#";
}
return res;
}
/**
* 根据platformKey更新platformValue
* @param object

View File

@@ -288,7 +288,9 @@ public class UserService {
* @param uuid 唯一标识
* @return 结果
*/
public void validateCaptcha(String code, String uuid) {
public void validateCaptcha(String code, String uuid) throws Exception {
PlatformConfig platformConfig = platformConfigService.getInfoByKey("checkcode_flag");
if(platformConfig!=null && "1".equals(platformConfig.getPlatformValue())) {
if(StringUtil.isNotEmpty(code) && StringUtil.isNotEmpty(uuid)) {
code = code.trim();
uuid = uuid.trim();
@@ -308,6 +310,7 @@ public class UserService {
throw new BusinessRunTimeException(ExceptionConstants.USER_JCAPTCHA_EMPTY_CODE, ExceptionConstants.USER_JCAPTCHA_EMPTY_MSG);
}
}
}
/**
* 用户登录