Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3080d8a936 | ||
|
|
3f951dfe47 | ||
|
|
9c66dafe6b | ||
|
|
d6ed2b8037 | ||
|
|
02c2ccc0ff |
18
pom.xml
18
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -58,49 +58,49 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-role</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.tiesheng.demo.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
@@ -30,11 +29,13 @@ import com.tiesheng.web.service.CoreLogService;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@@ -72,7 +73,9 @@ public class TestController {
|
||||
@RequestMapping("/redirect")
|
||||
@TokenIgnore
|
||||
@RoleAuthority("redirect")
|
||||
public ApiResp<JsonTest> redirect(@RequestBody JsonTest dto, HttpServletResponse response) {
|
||||
public ApiResp<JsonTest> redirect(HttpServletResponse response) {
|
||||
|
||||
encryptConfig.passwdCreate("111111@Zz", "");
|
||||
|
||||
JsonTest jsonTest = new JsonTest();
|
||||
jsonTest.setNow(DateUtil.date());
|
||||
@@ -81,8 +84,6 @@ public class TestController {
|
||||
String jsonString = JSON.toJSONString(jsonTest);
|
||||
LogFactory.get().info(jsonString);
|
||||
|
||||
LogFactory.get().info(JSON.toJSONString(dto));
|
||||
|
||||
// ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
|
||||
// coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
|
||||
// @Override
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.tiesheng.util.service.TsCacheService;
|
||||
import com.tiesheng.util.service.TsServiceBase;
|
||||
import com.tiesheng.util.service.role.TsAuthorityHandler;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -36,7 +35,12 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
||||
TsLoginConfigurer tsLoginConfigurer;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
/**
|
||||
* 登录操作
|
||||
*
|
||||
* @param loginInfo
|
||||
* @return
|
||||
*/
|
||||
public TokenBean login(DoLoginInfo loginInfo) {
|
||||
|
||||
int loginErrorTimes = coreLogLoginMapper.getLoginErrorTimes(loginInfo.getLoginIp());
|
||||
@@ -70,8 +74,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
||||
|
||||
// 更新唯一值
|
||||
String oldUserId = platformUnique.getUserId();
|
||||
if (!StrUtil.isEmpty(tokenBean.getId()) &&
|
||||
!Objects.equals(oldUserId, tokenBean.getId())) {
|
||||
if (!Objects.equals(oldUserId, tokenBean.getId())) {
|
||||
platformUnique.setUserId(tokenBean.getId());
|
||||
saveOrUpdate(platformUnique);
|
||||
}
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
</sql>
|
||||
|
||||
<select id="getLoginErrorTimes" resultType="int">
|
||||
select count(1)
|
||||
from core_log_login
|
||||
where ip = #{ip}
|
||||
and create_time > date_add(now(), interval -10 minute)
|
||||
select count(1)
|
||||
from core_log_login
|
||||
where ip = #{ip}
|
||||
and result = 0
|
||||
and create_time > date_add(now(), interval -10 minute)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-role</artifactId>
|
||||
|
||||
@@ -60,6 +60,7 @@ public class RoleAuthorityHandler implements TsAuthorityHandler {
|
||||
groupAuthority.setParent(parentId);
|
||||
groupAuthority.setVersion(version);
|
||||
groupAuthority.setSource("auto");
|
||||
groupAuthority.setDeps("[]");
|
||||
groupAuthority.setId(StrUtil.join("_", groupAuthority.getService(), groupAuthority.getNo()));
|
||||
list.add(groupAuthority);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
|
||||
@@ -28,6 +28,7 @@ public class EncryptConfig {
|
||||
private String key = "WmdUzPJXbngVNiaSsQrihg==";
|
||||
private Integer saltSize = 8;
|
||||
private boolean body = false;
|
||||
private String pwdPatten = "^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{8,}$";
|
||||
|
||||
public EncryptConfig() {
|
||||
sm4 = SmUtil.sm4(Base64.decode(getKey()));
|
||||
@@ -73,25 +74,13 @@ public class EncryptConfig {
|
||||
if (StrUtil.isEmpty(salt) || StrUtil.length(salt) != getSaltSize()) {
|
||||
salt = RandomUtil.randomString(saltSize);
|
||||
}
|
||||
if (!passwdComplexity(inputPasswd)) {
|
||||
throw new ApiException("需要包含数字、大小写字母、特殊符号,且长度不低于8位");
|
||||
if (!inputPasswd.matches(getPwdPatten())) {
|
||||
throw new ApiException("密码复杂度不够,请重新设置");
|
||||
}
|
||||
return encrypt(salt + SecureUtil.sha1(salt + inputPasswd));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 复杂度校验
|
||||
*
|
||||
* @param inputPasswd
|
||||
* @return
|
||||
*/
|
||||
public boolean passwdComplexity(String inputPasswd) {
|
||||
String password = "^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{8,}$";
|
||||
return inputPasswd.matches(password);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 密码校验
|
||||
*
|
||||
@@ -133,4 +122,12 @@ public class EncryptConfig {
|
||||
public void setBody(boolean body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getPwdPatten() {
|
||||
return pwdPatten;
|
||||
}
|
||||
|
||||
public void setPwdPatten(String pwdPatten) {
|
||||
this.pwdPatten = pwdPatten;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
@@ -26,6 +26,10 @@ public class ImageCodeDTO {
|
||||
if (height == null) {
|
||||
height = 62;
|
||||
}
|
||||
|
||||
width = Math.min(width, 500);
|
||||
height = Math.min(height, 200);
|
||||
|
||||
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(width, height, 4, lineCount);
|
||||
lineCaptcha.setGenerator(new RandomGenerator("0123456789", 4));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user