feat(security): 添加密码加密功能

在用户登录时对密码进行加密处理,使用 Base64 编码和 RSA 加密增强安全性
新增 crypto.js 工具文件并添加相关依赖
This commit is contained in:
houakang
2026-04-12 13:01:19 +08:00
parent 4708af1e93
commit 4bae331d4f
3 changed files with 42 additions and 1 deletions

View File

@@ -1,11 +1,13 @@
import { getAction, postAction, deleteAction } from './manage.js';
import url, { getBaseUrl } from './url.js';
import { encryptPassword } from '@/utils/crypto.js';
// 健康检查
export const getHealthAction = () => getAction(url.health);
// 用户登录
export const loginAction = (data, sparkBaseUrl) => postAction(url.user.login, data, {}, sparkBaseUrl);
export const loginAction = (data, sparkBaseUrl) =>
postAction(url.user.login, { email: data.email, password: encryptPassword(data.password) }, {}, sparkBaseUrl);
// 会话
export const createSessionAction = (data) => postAction(url.session.create, data);