fix sonar issue
This commit is contained in:
parent
4500ae3dac
commit
c22819d863
|
|
@ -7,30 +7,31 @@ package com.bonus.common.core.constant;
|
|||
*/
|
||||
public class CacheConstants
|
||||
{
|
||||
private CacheConstants(){}
|
||||
/**
|
||||
* 缓存有效期,默认720(分钟)
|
||||
*/
|
||||
public final static long EXPIRATION = 720;
|
||||
public static final long EXPIRATION = 720;
|
||||
|
||||
/**
|
||||
* 缓存刷新时间,默认120(分钟)
|
||||
*/
|
||||
public final static long REFRESH_TIME = 120;
|
||||
public static final long REFRESH_TIME = 120;
|
||||
|
||||
/**
|
||||
* 密码最大错误次数
|
||||
*/
|
||||
public final static int PASSWORD_MAX_RETRY_COUNT = 5;
|
||||
public static final int PASSWORD_MAX_RETRY_COUNT = 5;
|
||||
|
||||
/**
|
||||
* 密码锁定时间,默认10(分钟)
|
||||
*/
|
||||
public final static long PASSWORD_LOCK_TIME = 10;
|
||||
public static final long PASSWORD_LOCK_TIME = 10;
|
||||
|
||||
/**
|
||||
* 权限缓存前缀
|
||||
*/
|
||||
public final static String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
|
||||
|
||||
/**
|
||||
* 验证码 redis key
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package com.bonus.common.core.constant;
|
|||
*/
|
||||
public class Constants
|
||||
{
|
||||
private Constants(){}
|
||||
/**
|
||||
* UTF-8 字符集
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package com.bonus.common.core.constant;
|
|||
*/
|
||||
public class GenConstants
|
||||
{
|
||||
private GenConstants(){}
|
||||
/** 单表(增删改查) */
|
||||
public static final String TPL_CRUD = "crud";
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@ public class ValidateUtils {
|
|||
|
||||
public static int MIN_LENGTH=8;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.err.println(("Admin@1234567"));
|
||||
System.err.println(isPwd("admin@123456"));
|
||||
}
|
||||
|
||||
|
||||
public static String PASSWORD_ERROR = "密码必须包含大小写字母、数字、特殊字符,且长度在%s-%s位之间";
|
||||
/**
|
||||
* 密码校验
|
||||
*
|
||||
|
|
@ -35,10 +30,10 @@ public class ValidateUtils {
|
|||
public static String isPwd(String password) {
|
||||
|
||||
if (password.length() < MIN_LENGTH) {
|
||||
return "密码必须包含大小写字母、数字、特殊字符,且长度在"+MIN_LENGTH+"-"+MAX_LENGTH+"位之间";
|
||||
return String.format(PASSWORD_ERROR,MIN_LENGTH,MAX_LENGTH);
|
||||
}
|
||||
if (password.length() > MAX_LENGTH) {
|
||||
return "密码必须包含大小写字母、数字、特殊字符,且长度在"+MIN_LENGTH+"-"+MAX_LENGTH+"位之间";
|
||||
return String.format(PASSWORD_ERROR,MIN_LENGTH,MAX_LENGTH);
|
||||
}
|
||||
boolean hasUpperCase = false;
|
||||
boolean hasLowerCase = false;
|
||||
|
|
@ -59,6 +54,6 @@ public class ValidateUtils {
|
|||
if(hasUpperCase && hasLowerCase && hasDigit && hasSpecialChar){
|
||||
return null;
|
||||
}
|
||||
return "密码必须包含大小写字母、数字、特殊字符,且长度在"+MIN_LENGTH+"-"+MAX_LENGTH+"位之间";
|
||||
return String.format(PASSWORD_ERROR,MIN_LENGTH,MAX_LENGTH);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import com.bonus.common.core.constant.Constants;
|
|||
*
|
||||
* @author bonus
|
||||
*/
|
||||
|
||||
public class R<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
*
|
||||
* @author bonus
|
||||
*/
|
||||
|
||||
public class FileTypeUtils
|
||||
{
|
||||
/**
|
||||
|
|
@ -71,6 +70,7 @@ public class FileTypeUtils
|
|||
* @param photoByte 文件字节码
|
||||
* @return 后缀(不含".")
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public static String getFileExtendName(byte[] photoByte)
|
||||
{
|
||||
String strFileExtendName = "JPG";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.common.core.constant;
|
||||
|
||||
//import com.alibaba.nacos.common.JustForTest;
|
||||
//import com.bonus.common.core.utils.ServletUtils;
|
||||
//import com.bonus.common.core.utils.StringUtils;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.net.InetAddress;
|
||||
//import java.net.UnknownHostException;
|
||||
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.ip.IpUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* 获取IP方法
|
||||
*
|
||||
* @author bonus
|
||||
*/
|
||||
public class ValidateUtilsTests
|
||||
{
|
||||
@Test
|
||||
public void testIsPwd(){
|
||||
String msg = ValidateUtils.isPwd("pass");
|
||||
assertTrue(StringUtils.isNotEmpty(msg));
|
||||
|
||||
msg = ValidateUtils.isPwd("admin@123456");
|
||||
assertTrue(StringUtils.isNotEmpty(msg));
|
||||
|
||||
msg = ValidateUtils.isPwd("Admin@123456");
|
||||
assertFalse(StringUtils.isNotEmpty(msg));
|
||||
}
|
||||
}
|
||||
|
|
@ -205,7 +205,6 @@ public class SysUserController extends BaseController
|
|||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
ajax.put("roles", roles);
|
||||
// ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
ajax.put("posts", postService.selectPostAll());
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,16 +66,6 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||
public List<SysMenu> selectMenuList(SysMenu menu, Long userId)
|
||||
{
|
||||
List<SysMenu> menuList = menuMapper.selectMenuList(menu);
|
||||
/*// 管理员显示所有菜单信息
|
||||
if (SysUser.isAdmin(userId))
|
||||
{
|
||||
menuList = menuMapper.selectMenuList(menu);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.getParams().put("userId", userId);
|
||||
menuList = menuMapper.selectMenuListByUserId(menu);
|
||||
}*/
|
||||
return menuList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.bonus.common.log.enums.OperaType;
|
|||
import com.bonus.system.api.domain.SysLogsVo;
|
||||
import com.bonus.system.domain.SysLogsMenuHead;
|
||||
import com.bonus.system.domain.SysMenu;
|
||||
//import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
|
|||
Loading…
Reference in New Issue