diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java index 38721708..6b2e6c19 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java @@ -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()); diff --git a/mes/qd/src/views/login.vue b/mes/qd/src/views/login.vue index d9d2401f..cc64a506 100644 --- a/mes/qd/src/views/login.vue +++ b/mes/qd/src/views/login.vue @@ -119,14 +119,14 @@ export default { code: this.loginForm.code, uuid: this.loginForm.uuid } - if (user.password !== this.cookiePass) { - user.password = encrypt(user.password) - } + user.password = encrypt(user.password) + // if (user.password !== this.cookiePass) { + // } if (valid) { this.loading = true if (user.rememberMe) { Cookies.set('username', user.username, { expires: Config.passCookieExpires }) - Cookies.set('password', user.password, { expires: Config.passCookieExpires }) + Cookies.set('password', this.loginForm.password, { expires: Config.passCookieExpires }) Cookies.set('rememberMe', user.rememberMe, { expires: Config.passCookieExpires }) } else { Cookies.remove('username') diff --git a/mes/qd/src/views/system/user/index.vue b/mes/qd/src/views/system/user/index.vue index 8366c9d7..36c5bf2b 100644 --- a/mes/qd/src/views/system/user/index.vue +++ b/mes/qd/src/views/system/user/index.vue @@ -132,7 +132,7 @@ + + +