update ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java.

缺陷修复:导入用户数据时,生成的密码没有salt码,导致无法正常登录的问题;

Signed-off-by: showvim <showvim@qq.com>
pull/561/head
showvim 2025-07-25 02:37:03 +00:00 committed by Gitee
parent 70194aee09
commit af6aba133d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 1 deletions

View File

@ -517,7 +517,9 @@ public class SysUserServiceImpl implements ISysUserService
BeanValidators.validateWithException(validator, user);
deptService.checkDeptDataScope(user.getDeptId());
String password = configService.selectConfigByKey("sys.user.initPassword");
user.setPassword(Md5Utils.hash(user.getLoginName() + password));
// 设置salt并添加进加密规则中
user.setSalt(ShiroUtils.randomSalt());
user.setPassword(Md5Utils.hash(user.getLoginName() + password + user.getSalt()));
user.setCreateBy(operName);
userMapper.insertUser(user);
successNum++;