From 9015e720487b737743232b0b3aa464c2ac9e8d17 Mon Sep 17 00:00:00 2001
From: heheng <heheng@123456>
Date: 星期五, 15 十一月 2024 17:31:24 +0800
Subject: [PATCH] 修改请求地址

---
 src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java
index 1ec3101..31a1bf9 100644
--- a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.exception.BusinessException;
+import com.ruoyi.common.utils.RegexUtil;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.security.ShiroUtils;
 import com.ruoyi.common.utils.text.Convert;
@@ -220,6 +221,12 @@
     @Override
     @Transactional
     public int insertUser(User user) {
+        if(StringUtils.isEmpty(user.getPassword())){
+            throw new BusinessException("密码不能为空");
+        }
+        if(!RegexUtil.isPassword(user.getPassword())){
+            throw new BusinessException("密码无效。密码必须包含至少一个大写字母、一个小写字母和一个数字,并且至少10个字符长。");
+        }
         user.randomSalt();
         user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
         user.setCreateBy(ShiroUtils.getLoginName());
@@ -299,6 +306,12 @@
      */
     @Override
     public int resetUserPwd(User user) {
+        if(StringUtils.isEmpty(user.getPassword())){
+            throw new BusinessException("密码不能为空");
+        }
+        if(!RegexUtil.isPassword(user.getPassword())){
+            throw new BusinessException("密码无效。密码必须包含至少一个大写字母、一个小写字母和一个数字,并且至少10个字符长。");
+        }
         user.randomSalt();
         user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
         return updateUserInfo(user);
@@ -576,4 +589,19 @@
     public User getUserByName(String createBy) {
         return userMapper.getUserByName(createBy);
     }
+
+    @Override
+    public List<User> getAllUser() {
+        return userMapper.getAllUser();
+    }
+
+    @Override
+    public List<User> selectForUpdatePwd() {
+        return userMapper.selectForUpdatePwd();
+    }
+
+    @Override
+    public int updateUserForUpdatePwd(User user) {
+        return userMapper.updateUserForUpdatePwd(user);
+    }
 }

--
Gitblit v1.9.2