登录记住密码问题、管理员重置密码问题

This commit is contained in:
lyd
2022-11-16 14:33:40 +08:00
parent 609ddeb974
commit e635188279
3 changed files with 15 additions and 6 deletions

View File

@@ -15,6 +15,7 @@
*/
package org.nl.modules.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import org.nl.config.FileProperties;
@@ -35,6 +36,7 @@ import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -61,6 +63,7 @@ public class UserServiceImpl implements UserService {
private final RedisUtils redisUtils;
private final UserCacheClean userCacheClean;
private final OnlineUserService onlineUserService;
private final PasswordEncoder passwordEncoder;
@Override
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
@@ -135,6 +138,8 @@ public class UserServiceImpl implements UserService {
user.setGender(resources.getGender());
user.setExtId(resources.getExtId());
user.setExtuserId(resources.getExtuserId());
if (ObjectUtil.isNotEmpty(resources.getPassword()))
user.setPassword(passwordEncoder.encode(resources.getPassword()));
userRepository.save(user);
// 清除缓存
delCaches(user.getId(), user.getUsername());