fix:修改changPassword接口 使用配置文件默认密码

This commit is contained in:
orgin 2023-05-12 16:40:01 +08:00
parent c65e9b72a7
commit 20b6b2eaab

View File

@ -41,6 +41,7 @@ import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
@ -97,6 +98,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Autowired
private SysUserTenantMapper userTenantMapper;
@Value("${system.auth.defaultPassword}")
private String defaultPassword;
@Override
public Result<IPage<SysUser>> queryPageList(HttpServletRequest req, QueryWrapper<SysUser> queryWrapper, Integer pageSize, Integer pageNo) {
Result<IPage<SysUser>> result = new Result<IPage<SysUser>>();
@ -185,8 +189,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
public Result<?> changePassword(SysUser sysUser) {
String salt = oConvertUtils.randomGen(8);
sysUser.setSalt(salt);
String password = sysUser.getPassword();
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt);
String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), defaultPassword, salt);
sysUser.setPassword(passwordEncode);
this.userMapper.updateById(sysUser);
return Result.ok("密码修改成功!");