新增滑块验证码(待测试)
parent
3a445b42db
commit
72a263f1b2
|
@ -5,7 +5,6 @@
|
||||||
<database-info product="MySQL" version="8.0.26" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)" dbms="MYSQL" exact-version="8.0.26" exact-driver-version="8.2">
|
<database-info product="MySQL" version="8.0.26" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)" dbms="MYSQL" exact-version="8.0.26" exact-driver-version="8.2">
|
||||||
<extra-name-characters>#@</extra-name-characters>
|
<extra-name-characters>#@</extra-name-characters>
|
||||||
<identifier-quote-string>`</identifier-quote-string>
|
<identifier-quote-string>`</identifier-quote-string>
|
||||||
<jdbc-catalog-is-schema>true</jdbc-catalog-is-schema>
|
|
||||||
</database-info>
|
</database-info>
|
||||||
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
|
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
|
||||||
<secret-storage>master_key</secret-storage>
|
<secret-storage>master_key</secret-storage>
|
||||||
|
|
|
@ -4,26 +4,19 @@
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e53020f6-f301-415a-a26a-d22b9ac05907" name="更改" comment="安勇帅提交测试">
|
<list default="true" id="e53020f6-f301-415a-a26a-d22b9ac05907" name="更改" comment="连接数据源">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/controller/CaptchaController.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/config/DatabaseConfig.java" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/controller/UserController.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/controller/DatabaseController.java" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/domian/request/UserRequest.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/controller/PlaceController.java" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/serviceimpl/DefaultCaptchaServiceImpl.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/domian/pojo/DataPlace.java" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/resources/images/jigsaw/aaa.jpg" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/domian/pojo/DateType.java" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/resources/images/jigsaw/bbb.jpg" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/domian/request/PlaceRequest.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/mapper/PlaceMapper.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/service/PlaceService.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/serviceimpl/PlaceServiceImpl.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/setting.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/setting.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/etl-cleaning/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/etl-cleaning/pom.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/etl-cleaning/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/etl-cleaning/pom.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/config/DatabaseConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/config/DatabaseConfig.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/service/PlaceService.java" beforeDir="false" afterPath="$PROJECT_DIR$/etl-cleaning/src/main/java/com/etl/cleaning/service/PlaceService.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/etl-cleaning/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/etl-cleaning/src/main/resources/application.properties" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/etl-cleaning/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/etl-cleaning/src/main/resources/application.properties" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/etl-common/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/etl-common/pom.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/etl-common/target/classes/com/etl/common/result/Result.class" beforeDir="false" afterPath="$PROJECT_DIR$/etl-common/target/classes/com/etl/common/result/Result.class" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -46,6 +39,9 @@
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="HighlightingSettingsPerFile">
|
||||||
|
<setting file="jar://$MAVEN_REPOSITORY$/com/anji-plus/spring-boot-starter-captcha/1.3.0/spring-boot-starter-captcha-1.3.0.jar!/com/anji/captcha/properties/AjCaptchaProperties.class" root0="SKIP_INSPECTION" />
|
||||||
|
</component>
|
||||||
<component name="MarkdownSettingsMigration">
|
<component name="MarkdownSettingsMigration">
|
||||||
<option name="stateVersion" value="1" />
|
<option name="stateVersion" value="1" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -58,6 +54,9 @@
|
||||||
</MavenGeneralSettings>
|
</MavenGeneralSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="PerforceDirect.Settings">
|
||||||
|
<option name="CHARSET" value="无" />
|
||||||
|
</component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
"customColor": "",
|
"customColor": "",
|
||||||
"associatedIndex": 3
|
"associatedIndex": 3
|
||||||
|
@ -93,7 +92,7 @@
|
||||||
"project.structure.side.proportion": "0.0",
|
"project.structure.side.proportion": "0.0",
|
||||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||||
"run.configurations.included.in.services": "true",
|
"run.configurations.included.in.services": "true",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||||
"spring.configuration.checksum": "a925cb78a857f19db6d9680ed9c97ee6",
|
"spring.configuration.checksum": "a925cb78a857f19db6d9680ed9c97ee6",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
},
|
},
|
||||||
|
@ -103,6 +102,11 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}]]></component>
|
}]]></component>
|
||||||
|
<component name="RecentsManager">
|
||||||
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
|
<recent name="D:\workspace\ETL\etl-cleaning\src\main\resources\images\jigsaw" />
|
||||||
|
</key>
|
||||||
|
</component>
|
||||||
<component name="RunDashboard">
|
<component name="RunDashboard">
|
||||||
<option name="configurationTypes">
|
<option name="configurationTypes">
|
||||||
<set>
|
<set>
|
||||||
|
@ -174,6 +178,7 @@
|
||||||
<workItem from="1719028436082" duration="3861000" />
|
<workItem from="1719028436082" duration="3861000" />
|
||||||
<workItem from="1719109446766" duration="4717000" />
|
<workItem from="1719109446766" duration="4717000" />
|
||||||
<workItem from="1719189307585" duration="23976000" />
|
<workItem from="1719189307585" duration="23976000" />
|
||||||
|
<workItem from="1719275575437" duration="16140000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="安勇帅提交测试">
|
<task id="LOCAL-00001" summary="安勇帅提交测试">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
|
@ -207,7 +212,15 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1718800633503</updated>
|
<updated>1718800633503</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="5" />
|
<task id="LOCAL-00005" summary="连接数据源">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1719275677546</created>
|
||||||
|
<option name="number" value="00005" />
|
||||||
|
<option name="presentableId" value="LOCAL-00005" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1719275677546</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="6" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
@ -224,6 +237,21 @@
|
||||||
<option value="origin/ays" />
|
<option value="origin/ays" />
|
||||||
</option>
|
</option>
|
||||||
</RecentGroup>
|
</RecentGroup>
|
||||||
|
<RecentGroup>
|
||||||
|
<option name="FILTER_VALUES">
|
||||||
|
<option value="origin/main" />
|
||||||
|
</option>
|
||||||
|
</RecentGroup>
|
||||||
|
<RecentGroup>
|
||||||
|
<option name="FILTER_VALUES">
|
||||||
|
<option value="origin/lzz" />
|
||||||
|
</option>
|
||||||
|
</RecentGroup>
|
||||||
|
<RecentGroup>
|
||||||
|
<option name="FILTER_VALUES">
|
||||||
|
<option value="origin/lzm" />
|
||||||
|
</option>
|
||||||
|
</RecentGroup>
|
||||||
<RecentGroup>
|
<RecentGroup>
|
||||||
<option name="FILTER_VALUES">
|
<option name="FILTER_VALUES">
|
||||||
<option value="ays" />
|
<option value="ays" />
|
||||||
|
@ -263,7 +291,8 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="安勇帅提交测试" />
|
<MESSAGE value="安勇帅提交测试" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="安勇帅提交测试" />
|
<MESSAGE value="连接数据源" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="连接数据源" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
|
|
@ -19,6 +19,16 @@
|
||||||
<spring-boot.version>2.6.13</spring-boot.version>
|
<spring-boot.version>2.6.13</spring-boot.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.anji-plus</groupId>
|
||||||
|
<artifactId>spring-boot-starter-captcha</artifactId>
|
||||||
|
<version>1.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-jdbc</artifactId>
|
<artifactId>spring-jdbc</artifactId>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.etl.cleaning.config;
|
package com.etl.cleaning.config;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.etl.cleaning.controller;
|
||||||
|
|
||||||
|
import com.anji.captcha.model.common.ResponseModel;
|
||||||
|
import com.anji.captcha.model.vo.CaptchaVO;
|
||||||
|
import com.anji.captcha.service.CaptchaService;
|
||||||
|
import com.etl.common.util.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取滑块验证码
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/captcha")
|
||||||
|
public class CaptchaController {
|
||||||
|
@Autowired
|
||||||
|
private CaptchaService captchaService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping({"/get"})
|
||||||
|
public ResponseModel get(@RequestBody CaptchaVO data, HttpServletRequest request) {
|
||||||
|
assert request.getRemoteHost() != null;
|
||||||
|
|
||||||
|
data.setBrowserInfo(getRemoteId(request));
|
||||||
|
return this.captchaService.get(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping({"/check"})
|
||||||
|
public ResponseModel check(@RequestBody CaptchaVO data, HttpServletRequest request) {
|
||||||
|
data.setBrowserInfo(getRemoteId(request));
|
||||||
|
return this.captchaService.check(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseModel verify(@RequestBody CaptchaVO data, HttpServletRequest request) {
|
||||||
|
return this.captchaService.verification(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String getRemoteId(HttpServletRequest request) {
|
||||||
|
String xfwd = request.getHeader("X-Forwarded-For");
|
||||||
|
String ip = getRemoteIpFromXfwd(xfwd);
|
||||||
|
String ua = request.getHeader("user-agent");
|
||||||
|
return StringUtils.isNotBlank(ip) ? ip + ua : request.getRemoteAddr() + ua;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getRemoteIpFromXfwd(String xfwd) {
|
||||||
|
if (StringUtils.isNotBlank(xfwd)) {
|
||||||
|
String[] ipList = xfwd.split(",");
|
||||||
|
return StringUtils.trim(ipList[0]);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.etl.cleaning.controller;
|
||||||
|
|
||||||
|
import com.etl.cleaning.domian.request.UserRequest;
|
||||||
|
import com.etl.common.result.Result;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录测试(滑块验证码)
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user")
|
||||||
|
public class UserController {
|
||||||
|
/**
|
||||||
|
* 登录测试
|
||||||
|
* @param userRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/login")
|
||||||
|
public Result loginUser(@RequestBody UserRequest userRequest){
|
||||||
|
if(!userRequest.getName().equals("admin")){
|
||||||
|
throw new RuntimeException("用户名错误");
|
||||||
|
}
|
||||||
|
if(!userRequest.getPassword().equals("admin")){
|
||||||
|
throw new RuntimeException("密码错误");
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.etl.cleaning.domian.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserRequest {
|
||||||
|
private String name;
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
|
|
|
@ -2,8 +2,13 @@ package com.etl.cleaning.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.etl.cleaning.domian.pojo.DataPlace;
|
import com.etl.cleaning.domian.pojo.DataPlace;
|
||||||
|
import com.etl.cleaning.domian.request.PlaceRequest;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源管理
|
* 数据源管理
|
||||||
*/
|
*/
|
||||||
public interface PlaceService extends IService<DataPlace> {
|
public interface PlaceService extends IService<DataPlace> {
|
||||||
|
List<DataPlace> showPlacePage(PlaceRequest placeRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
package com.etl.cleaning.serviceimpl;
|
||||||
|
|
||||||
|
import com.anji.captcha.model.common.RepCodeEnum;
|
||||||
|
import com.anji.captcha.model.common.ResponseModel;
|
||||||
|
import com.anji.captcha.model.vo.CaptchaVO;
|
||||||
|
import com.anji.captcha.service.CaptchaService;
|
||||||
|
import com.anji.captcha.service.impl.CaptchaServiceFactory;
|
||||||
|
import com.anji.captcha.util.StringUtils;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Properties;
|
||||||
|
import com.anji.captcha.service.impl.AbstractCaptchaService;
|
||||||
|
|
||||||
|
public class DefaultCaptchaServiceImpl extends AbstractCaptchaService {
|
||||||
|
public DefaultCaptchaServiceImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String captchaType() {
|
||||||
|
return "default";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(Properties config) {
|
||||||
|
Iterator var2 = CaptchaServiceFactory.instances.keySet().iterator();
|
||||||
|
|
||||||
|
while(var2.hasNext()) {
|
||||||
|
String s = (String)var2.next();
|
||||||
|
if (!this.captchaType().equals(s)) {
|
||||||
|
this.getService(s).init(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy(Properties config) {
|
||||||
|
Iterator var2 = CaptchaServiceFactory.instances.keySet().iterator();
|
||||||
|
|
||||||
|
while(var2.hasNext()) {
|
||||||
|
String s = (String)var2.next();
|
||||||
|
if (!this.captchaType().equals(s)) {
|
||||||
|
this.getService(s).destroy(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private CaptchaService getService(String captchaType) {
|
||||||
|
return (CaptchaService)CaptchaServiceFactory.instances.get(captchaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseModel get(CaptchaVO captchaVO) {
|
||||||
|
if (captchaVO == null) {
|
||||||
|
return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"captchaVO"});
|
||||||
|
} else {
|
||||||
|
return StringUtils.isEmpty(captchaVO.getCaptchaType()) ? RepCodeEnum.NULL_ERROR.parseError(new Object[]{"类型"}) : this.getService(captchaVO.getCaptchaType()).get(captchaVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseModel check(CaptchaVO captchaVO) {
|
||||||
|
if (captchaVO == null) {
|
||||||
|
return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"captchaVO"});
|
||||||
|
} else if (StringUtils.isEmpty(captchaVO.getCaptchaType())) {
|
||||||
|
return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"类型"});
|
||||||
|
} else {
|
||||||
|
return StringUtils.isEmpty(captchaVO.getToken()) ? RepCodeEnum.NULL_ERROR.parseError(new Object[]{"token"}) : this.getService(captchaVO.getCaptchaType()).check(captchaVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseModel verification(CaptchaVO captchaVO) {
|
||||||
|
if (captchaVO == null) {
|
||||||
|
return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"captchaVO"});
|
||||||
|
} else if (StringUtils.isEmpty(captchaVO.getCaptchaVerification())) {
|
||||||
|
return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"二次校验参数"});
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
String codeKey = String.format(REDIS_SECOND_CAPTCHA_KEY, captchaVO.getCaptchaVerification());
|
||||||
|
if (!CaptchaServiceFactory.getCache(cacheType).exists(codeKey)) {
|
||||||
|
return ResponseModel.errorMsg(RepCodeEnum.API_CAPTCHA_INVALID);
|
||||||
|
}
|
||||||
|
CaptchaServiceFactory.getCache(cacheType).delete(codeKey);
|
||||||
|
} catch (Exception var3) {
|
||||||
|
this.logger.error("验证码坐标解析失败", var3);
|
||||||
|
return ResponseModel.errorMsg(var3.getMessage());
|
||||||
|
}
|
||||||
|
return ResponseModel.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,2 +1,71 @@
|
||||||
server.port=8080
|
server.port=8080
|
||||||
|
# redis
|
||||||
|
spring.redis.host=47.101.130.221
|
||||||
|
spring.redis.port=6379
|
||||||
|
spring.redis.password=123456
|
||||||
|
# ????????????????????
|
||||||
|
# ?????
|
||||||
|
# ??????,?classpath:??,?resource?????,??classpath:images/jigsaw
|
||||||
|
aj.captcha.jigsaw=classpath:images/jigsaw/bbb.jpg
|
||||||
|
# ????????????????????
|
||||||
|
# ?????
|
||||||
|
# ??????,?classpath:??,?resource?????,??classpath:images/pic-click
|
||||||
|
aj.captcha.pic-click=classpath:images/jigsaw/aaa.jpg
|
||||||
|
# ?????????????????????CaptchaCacheService????Redis??memcache?
|
||||||
|
# ??CaptchaCacheServiceRedisImpl.java
|
||||||
|
# ??????????????redis?????????
|
||||||
|
# ??????????????????????????????????????????
|
||||||
|
# ??????????????spring-boot-starter-data-redis?
|
||||||
|
# ???CaptchaCacheServiceRedisImpl.java???
|
||||||
|
# redis -----> SPI??resources????META-INF.services???(??)???????resources?
|
||||||
|
# ??local/redis...
|
||||||
|
aj.captcha.cache-type=local
|
||||||
|
# local?????,??????????
|
||||||
|
#aj.captcha.cache-number=1000
|
||||||
|
# local????????(???),???0?????
|
||||||
|
#aj.captcha.timing-clear=180
|
||||||
|
#spring.redis.host=10.108.11.46
|
||||||
|
#spring.redis.port=6379
|
||||||
|
#spring.redis.password=
|
||||||
|
#spring.redis.database=2
|
||||||
|
#spring.redis.timeout=6000
|
||||||
|
|
||||||
|
# ?????default???????
|
||||||
|
aj.captcha.type=default
|
||||||
|
# ??????Unicode,??????@value????????????????
|
||||||
|
# https://tool.chinaz.com/tools/unicode.aspx ???Unicode
|
||||||
|
# ???????(????)
|
||||||
|
aj.captcha.water-mark=????????
|
||||||
|
# ???????(??????????????)
|
||||||
|
# ?????????????jar???????????????
|
||||||
|
# ????????OS???????????????
|
||||||
|
# ????????????????????resources?fonts??????ttf\ttc\otf??
|
||||||
|
# aj.captcha.water-font=WenQuanZhengHei.ttf
|
||||||
|
# ????????????(?????)
|
||||||
|
# aj.captcha.font-type=WenQuanZhengHei.ttf
|
||||||
|
# ?????????????(??5??)
|
||||||
|
aj.captcha.slip-offset=5
|
||||||
|
# aes??????????(true|false)
|
||||||
|
aj.captcha.aes-status=true
|
||||||
|
# ?????(0/1/2)
|
||||||
|
aj.captcha.interference-options=2
|
||||||
|
#?????? ??Font.BOLD
|
||||||
|
aj.captcha.font-style=1
|
||||||
|
#????????
|
||||||
|
aj.captcha.font-size=25
|
||||||
|
#??????,???????????
|
||||||
|
#aj.captcha.click-word-count=4
|
||||||
|
aj.captcha.history-data-clear-enable=false
|
||||||
|
# ??????????????? true|false
|
||||||
|
aj.captcha.req-frequency-limit-enable=false
|
||||||
|
# ????5??get????
|
||||||
|
aj.captcha.req-get-lock-limit=5
|
||||||
|
# ????????????,s
|
||||||
|
aj.captcha.req-get-lock-seconds=360
|
||||||
|
# get???????????
|
||||||
|
aj.captcha.req-get-minute-limit=30
|
||||||
|
# check???????????
|
||||||
|
aj.captcha.req-check-minute-limit=30
|
||||||
|
# verify???????????(????????????captchaService)
|
||||||
|
#aj.captcha.req-verify-minute-limit=30
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
Loading…
Reference in New Issue