From e6351882794b112397459f9ba7153679b0be6e78 Mon Sep 17 00:00:00 2001
From: lyd <1419499670@qq.com>
Date: Wed, 16 Nov 2022 14:33:40 +0800
Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=AE=B0=E4=BD=8F=E5=AF=86?=
=?UTF-8?q?=E7=A0=81=E9=97=AE=E9=A2=98=E3=80=81=E7=AE=A1=E7=90=86=E5=91=98?=
=?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=AF=86=E7=A0=81=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../nl/modules/system/service/impl/UserServiceImpl.java | 5 +++++
mes/qd/src/views/login.vue | 8 ++++----
mes/qd/src/views/system/user/index.vue | 8 ++++++--
3 files changed, 15 insertions(+), 6 deletions(-)
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 @@