|
@@ -20,6 +20,8 @@ import { RoleEnum } from '/@/enums/roleEnum';
|
|
|
import { useSso } from '/@/hooks/web/useSso';
|
|
|
import { getActions } from '/@/qiankun/state';
|
|
|
import { MOCK_LOGIN_PASSWORD, MOCK_LOGIN_UESRNAME } from '../constant';
|
|
|
+import { AesEncryption } from '/@/utils/cipher';
|
|
|
+import { loginCipher } from '/@/settings/encryptionSetting';
|
|
|
|
|
|
interface UserState {
|
|
|
userInfo: Nullable<UserInfo>;
|
|
@@ -146,6 +148,9 @@ export const useUserStore = defineStore({
|
|
|
): Promise<GetUserInfoModel | null> {
|
|
|
try {
|
|
|
const { goHome = true, mode, successMode, ...loginParams } = params;
|
|
|
+ // 进行加密
|
|
|
+ const encryption = new AesEncryption({ key: loginCipher.key, iv: loginCipher.iv });
|
|
|
+ // loginParams.password = encryption.encryptByAES(loginParams.password);
|
|
|
const data = await loginApi(loginParams, mode, successMode);
|
|
|
const { token, userInfo } = data;
|
|
|
// save token
|
|
@@ -401,6 +406,7 @@ export const useUserStore = defineStore({
|
|
|
});
|
|
|
router.go(0);
|
|
|
},
|
|
|
+
|
|
|
/** 用户自动登录,即不需要用户密码即可登录 */
|
|
|
async autoLogin(
|
|
|
params: AutoLoginParams & {
|
|
@@ -410,6 +416,9 @@ export const useUserStore = defineStore({
|
|
|
}
|
|
|
) {
|
|
|
const { goHome = true, mode, successMode = 'none', ...loginParams } = params;
|
|
|
+ // 进行加密
|
|
|
+ // const encryption = new AesEncryption({ key: loginCipher.key, iv: loginCipher.iv });
|
|
|
+ // loginParams.password = encryption.encryptByAES(loginParams.password);
|
|
|
const data = await autoLoginApi(loginParams, mode, successMode);
|
|
|
const { token, userInfo } = data;
|
|
|
// save token
|