From 64eb1c2ebfc25f11f5757a0eef04de230fa8fa15 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 04 十二月 2025 17:52:54 +0800
Subject: [PATCH] fix: 账号密码双因子登录
---
src/store/modules/user.ts | 31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 49bd21d..c226b2e 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -68,15 +68,7 @@
.then((res) => {
if (res) {
console.log('res: ', res);
- this.setToken(res.accessToken);
-
- const accountInfo = getAccountInfoFromAccessToken(res.accessToken);
-
- this.setName(accountInfo.name);
- this.setAccountInfo(accountInfo);
-
- // 鑾峰彇鐢ㄦ埛淇℃伅
- this.setUserInfo(res);
+ this.loginSuccess(res);
resolve();
}
@@ -87,6 +79,27 @@
});
},
+ async twoFactorLoginSms(params: API.TwoFactorLoginSmsInput) {
+ try {
+ let res = await accountServices.twoFactorLoginSms(params, { showLoading: false });
+ if (res) {
+ this.loginSuccess(res);
+ }
+ } catch (error) {}
+ },
+
+ loginSuccess(res: API.IdentityModelToken) {
+ this.setToken(res.accessToken);
+
+ const accountInfo = getAccountInfoFromAccessToken(res.accessToken);
+
+ this.setName(accountInfo.name);
+ this.setAccountInfo(accountInfo);
+
+ // 鑾峰彇鐢ㄦ埛淇℃伅
+ this.setUserInfo(res);
+ },
+
// 鐧诲嚭 娓呯┖缂撳瓨
logout(redirectPath = '/') {
return new Promise(async (resolve) => {
--
Gitblit v1.9.1