修改用户密码加密和验证方式
This commit is contained in:
@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.crypto.digest.MD5;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
@@ -33,6 +35,7 @@ import com.mzt.logapi.context.LogRecordContext;
|
|||||||
import com.mzt.logapi.service.impl.DiffParseFunction;
|
import com.mzt.logapi.service.impl.DiffParseFunction;
|
||||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -61,6 +64,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
|
|
||||||
static final String USER_REGISTER_ENABLED_KEY = "system.user.register-enabled";
|
static final String USER_REGISTER_ENABLED_KEY = "system.user.register-enabled";
|
||||||
|
|
||||||
|
@Value("${md5.salt}")
|
||||||
|
private String MD5_SALT;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AdminUserMapper userMapper;
|
private AdminUserMapper userMapper;
|
||||||
|
|
||||||
@@ -504,7 +510,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPasswordMatch(String rawPassword, String encodedPassword) {
|
public boolean isPasswordMatch(String rawPassword, String encodedPassword) {
|
||||||
return passwordEncoder.matches(rawPassword, encodedPassword);
|
String s = SecureUtil.md5(MD5_SALT + rawPassword);
|
||||||
|
return s.equals(encodedPassword);
|
||||||
|
// return passwordEncoder.matches(rawPassword, encodedPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -514,7 +522,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
* @return 加密后的密码
|
* @return 加密后的密码
|
||||||
*/
|
*/
|
||||||
private String encodePassword(String password) {
|
private String encodePassword(String password) {
|
||||||
return passwordEncoder.encode(password);
|
return SecureUtil.md5(MD5_SALT + password);
|
||||||
|
// return passwordEncoder.encode(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,9 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
autoconfigure:
|
autoconfigure:
|
||||||
exclude:
|
exclude:
|
||||||
- org.springframework.ai.autoconfigure.vectorstore.qdrant.QdrantVectorStoreAutoConfiguration # 禁用 AI 模块的 Qdrant,手动创建
|
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 禁用 AI 模块的 Milvus,手动创建
|
||||||
- org.springframework.ai.autoconfigure.vectorstore.milvus.MilvusVectorStoreAutoConfiguration # 禁用 AI 模块的 Milvus,手动创建
|
|
||||||
# 数据源配置项
|
# 数据源配置项
|
||||||
autoconfigure:
|
|
||||||
exclude:
|
|
||||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
|
||||||
datasource:
|
datasource:
|
||||||
druid: # Druid 【监控】相关的全局配置
|
druid: # Druid 【监控】相关的全局配置
|
||||||
web-stat-filter:
|
web-stat-filter:
|
||||||
|
|||||||
@@ -208,32 +208,6 @@ yudao:
|
|||||||
miniprogram-state: developer # 跳转小程序类型:开发版为 “developer”;体验版为 “trial”为;正式版为 “formal”
|
miniprogram-state: developer # 跳转小程序类型:开发版为 “developer”;体验版为 “trial”为;正式版为 “formal”
|
||||||
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
||||||
|
|
||||||
justauth:
|
|
||||||
enabled: true
|
|
||||||
type:
|
|
||||||
DINGTALK: # 钉钉
|
|
||||||
client-id: dingvrnreaje3yqvzhxg
|
|
||||||
client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI
|
|
||||||
ignore-check-redirect-uri: true
|
|
||||||
WECHAT_ENTERPRISE: # 企业微信
|
|
||||||
client-id: wwd411c69a39ad2e54
|
|
||||||
client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw
|
|
||||||
agent-id: 1000004
|
|
||||||
ignore-check-redirect-uri: true
|
|
||||||
# noinspection SpringBootApplicationYaml
|
|
||||||
WECHAT_MINI_PROGRAM: # 微信小程序
|
|
||||||
client-id: ${wx.miniapp.appid}
|
|
||||||
client-secret: ${wx.miniapp.secret}
|
|
||||||
ignore-check-redirect-uri: true
|
|
||||||
ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验
|
|
||||||
WECHAT_MP: # 微信公众号
|
|
||||||
client-id: ${wx.mp.app-id}
|
|
||||||
client-secret: ${wx.mp.secret}
|
|
||||||
ignore-check-redirect-uri: true
|
|
||||||
cache:
|
|
||||||
type: REDIS
|
|
||||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
|
||||||
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
|
||||||
|
|
||||||
--- #################### iot相关配置 TODO 芋艿【IOT】:再瞅瞅 ####################
|
--- #################### iot相关配置 TODO 芋艿【IOT】:再瞅瞅 ####################
|
||||||
pf4j:
|
pf4j:
|
||||||
|
|||||||
@@ -52,17 +52,6 @@ knife4j:
|
|||||||
setting:
|
setting:
|
||||||
language: zh_cn
|
language: zh_cn
|
||||||
|
|
||||||
# 工作流 Flowable 配置
|
|
||||||
flowable:
|
|
||||||
# 1. false: 默认值,Flowable 启动时,对比数据库表中保存的版本,如果不匹配。将抛出异常
|
|
||||||
# 2. true: 启动时会对数据库中所有表进行更新操作,如果表存在,不做处理,反之,自动创建表
|
|
||||||
# 3. create_drop: 启动时自动创建表,关闭时自动删除表
|
|
||||||
# 4. drop_create: 启动时,删除旧表,再创建新表
|
|
||||||
database-schema-update: true # 设置为 false,可通过 https://github.com/flowable/flowable-sql 初始化
|
|
||||||
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
|
|
||||||
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
|
||||||
history-level: audit # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
|
||||||
|
|
||||||
# MyBatis Plus 的配置项
|
# MyBatis Plus 的配置项
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
@@ -145,87 +134,7 @@ spring:
|
|||||||
|
|
||||||
--- #################### AI 相关配置 ####################
|
--- #################### AI 相关配置 ####################
|
||||||
|
|
||||||
spring:
|
|
||||||
ai:
|
|
||||||
vectorstore: # 向量存储
|
|
||||||
redis:
|
|
||||||
initialize-schema: true
|
|
||||||
index: knowledge_index # Redis 中向量索引的名称:用于存储和检索向量数据的索引标识符,所有相关的向量搜索操作都会基于这个索引进行
|
|
||||||
prefix: "knowledge_segment:" # Redis 中存储向量数据的键名前缀:这个前缀会添加到每个存储在 Redis 中的向量数据键名前,每个 document 都是一个 hash 结构
|
|
||||||
qdrant:
|
|
||||||
initialize-schema: true
|
|
||||||
collection-name: knowledge_segment # Qdrant 中向量集合的名称:用于存储向量数据的集合标识符,所有相关的向量操作都会在这个集合中进行
|
|
||||||
host: 127.0.0.1
|
|
||||||
port: 6334
|
|
||||||
milvus:
|
|
||||||
initialize-schema: true
|
|
||||||
database-name: default # Milvus 中数据库的名称
|
|
||||||
collection-name: knowledge_segment # Milvus 中集合的名称:用于存储向量数据的集合标识符,所有相关的向量操作都会在这个集合中进行
|
|
||||||
client:
|
|
||||||
host: 127.0.0.1
|
|
||||||
port: 19530
|
|
||||||
qianfan: # 文心一言
|
|
||||||
api-key: x0cuLZ7XsaTCU08vuJWO87Lg
|
|
||||||
secret-key: R9mYF9dl9KASgi5RUq0FQt3wRisSnOcK
|
|
||||||
zhipuai: # 智谱 AI
|
|
||||||
api-key: 32f84543e54eee31f8d56b2bd6020573.3vh9idLJZ2ZhxDEs
|
|
||||||
openai: # OpenAI 官方
|
|
||||||
api-key: sk-aN6nWn3fILjrgLFT0fC4Aa60B72e4253826c77B29dC94f17
|
|
||||||
base-url: https://api.gptsapi.net
|
|
||||||
azure: # OpenAI 微软
|
|
||||||
openai:
|
|
||||||
endpoint: https://eastusprejade.openai.azure.com
|
|
||||||
api-key: xxx
|
|
||||||
ollama:
|
|
||||||
base-url: http://127.0.0.1:11434
|
|
||||||
chat:
|
|
||||||
model: llama3
|
|
||||||
stabilityai:
|
|
||||||
api-key: sk-e53UqbboF8QJCscYvzJscJxJXoFcFg4iJjl1oqgE7baJETmx
|
|
||||||
dashscope: # 通义千问
|
|
||||||
api-key: sk-71800982914041848008480000000000
|
|
||||||
minimax: # Minimax:https://www.minimaxi.com/
|
|
||||||
api-key: xxxx
|
|
||||||
moonshot: # 月之暗灭(KIMI)
|
|
||||||
api-key: sk-abc
|
|
||||||
|
|
||||||
yudao:
|
|
||||||
ai:
|
|
||||||
deep-seek: # DeepSeek
|
|
||||||
enable: true
|
|
||||||
api-key: sk-e94db327cc7d457d99a8de8810fc6b12
|
|
||||||
model: deepseek-chat
|
|
||||||
doubao: # 字节豆包
|
|
||||||
enable: true
|
|
||||||
api-key: 5c1b5747-26d2-4ebd-a4e0-dd0e8d8b4272
|
|
||||||
model: doubao-1-5-lite-32k-250115
|
|
||||||
hunyuan: # 腾讯混元
|
|
||||||
enable: true
|
|
||||||
api-key: sk-abc
|
|
||||||
model: hunyuan-turbo
|
|
||||||
siliconflow: # 硅基流动
|
|
||||||
enable: true
|
|
||||||
api-key: sk-epsakfenqnyzoxhmbucsxlhkdqlcbnimslqoivkshalvdozz
|
|
||||||
model: deepseek-ai/DeepSeek-R1-Distill-Qwen-7B
|
|
||||||
xinghuo: # 讯飞星火
|
|
||||||
enable: true
|
|
||||||
appKey: 75b161ed2aef4719b275d6e7f2a4d4cd
|
|
||||||
secretKey: YWYxYWI2MTA4ODI2NGZlYTQyNjAzZTcz
|
|
||||||
model: generalv3.5
|
|
||||||
baichuan: # 百川智能
|
|
||||||
enable: true
|
|
||||||
api-key: sk-abc
|
|
||||||
model: Baichuan4-Turbo
|
|
||||||
midjourney:
|
|
||||||
enable: true
|
|
||||||
# base-url: https://api.holdai.top/mj-relax/mj
|
|
||||||
base-url: https://api.holdai.top/mj
|
|
||||||
api-key: sk-dZEPiVaNcT3FHhef51996bAa0bC74806BeAb620dA5Da10Bf
|
|
||||||
notify-url: http://java.nat300.top/admin-api/ai/image/midjourney/notify
|
|
||||||
suno:
|
|
||||||
enable: true
|
|
||||||
# base-url: https://suno-55ishh05u-status2xxs-projects.vercel.app
|
|
||||||
base-url: http://127.0.0.1:3001
|
|
||||||
|
|
||||||
--- #################### 芋道相关配置 ####################
|
--- #################### 芋道相关配置 ####################
|
||||||
|
|
||||||
@@ -316,3 +225,6 @@ debug: false
|
|||||||
# 插件配置 TODO 芋艿:【IOT】需要处理下
|
# 插件配置 TODO 芋艿:【IOT】需要处理下
|
||||||
pf4j:
|
pf4j:
|
||||||
pluginsDir: /Users/anhaohao/code/gitee/ruoyi-vue-pro/plugins # 插件目录
|
pluginsDir: /Users/anhaohao/code/gitee/ruoyi-vue-pro/plugins # 插件目录
|
||||||
|
|
||||||
|
md5:
|
||||||
|
salt: (-FhqvXO,wMz
|
||||||
Reference in New Issue
Block a user