创建店铺密码强度校验

修改密码 可通过验证码
发送验证码类型限制
This commit is contained in:
2026-04-27 10:08:16 +08:00
parent c3ae15c7cc
commit 91fc6643a8
10 changed files with 93 additions and 38 deletions

View File

@@ -1,12 +1,8 @@
package com.czg.account.dto.user;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author Administrator
*/
@@ -22,17 +18,21 @@ public class SysUserEditPwdDTO {
*/
// @NotBlank(message = "原密码不为空")
private String originalPassword;
/**
* 验证码
*/
private String code;
/**
* 确认密码
*/
@NotBlank(message = "确认密码不为空")
@NotBlank(message = "确认密码不为空")
private String checkPassword;
/**
* 密码
*/
@NotBlank(message = "确认密码不为空")
@NotBlank(message = "密码不为空")
private String password;

View File

@@ -30,9 +30,9 @@ public interface ShopInfoService extends IService<ShopInfo> {
*/
boolean checkSwitch(Long shopId, ShopSwitchTypeEnum switchType) throws ValidateException;
Page<ShopInfo> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop);
Page<ShopDetailDTO> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop);
Page<ShopInfo> getShopByMainId(PageDTO pageDTO, String shopName, Integer status);
Page<ShopDetailDTO> getShopByMainId(PageDTO pageDTO, String shopName, Integer status);
Boolean add(ShopInfoAddDTO shopInfoAddDTO);

View File

@@ -1,6 +1,8 @@
package com.czg.utils;
import cn.hutool.core.text.PasswdStrength;
import cn.hutool.core.util.StrUtil;
import com.czg.exception.CzgException;
import java.time.LocalDate;
@@ -21,6 +23,7 @@ public class CzgStrUtils {
/**
* 获取当天是周几
*
* @return 周几
*/
public static String getStrWeek() {
@@ -31,4 +34,17 @@ public class CzgStrUtils {
return "" + chineseWeeks[dayOfWeek];
}
public static void checkPwd(String pwd) {
if (StrUtil.isBlank(pwd)) {
throw new CzgException("密码不能为空");
}
if (pwd.length() < 6) {
throw new CzgException("密码长度不能小于6");
}
PasswdStrength.PASSWD_LEVEL level = PasswdStrength.getLevel(pwd);
if (level == PasswdStrength.PASSWD_LEVEL.EASY) {
throw new CzgException("密码强度弱,需包含字母、数字、特殊符号中至少两种");
}
}
}