mirror of
https://github.com/certd/certd.git
synced 2026-05-15 04:27:31 +08:00
fix: 修复第三方登录丢失state时无法在用户信息页面绑定第三方账号的bug
This commit is contained in:
@@ -38,6 +38,9 @@ export const useUserStore = defineStore({
|
|||||||
getToken(): string {
|
getToken(): string {
|
||||||
return this.token || LocalStorage.get(TOKEN_KEY);
|
return this.token || LocalStorage.get(TOKEN_KEY);
|
||||||
},
|
},
|
||||||
|
isLogined(): boolean {
|
||||||
|
return !!this.getToken;
|
||||||
|
},
|
||||||
isAdmin(): boolean {
|
isAdmin(): boolean {
|
||||||
return this.getUserInfo.roleIds?.includes(1) || this.getUserInfo.id === 1;
|
return this.getUserInfo.roleIds?.includes(1) || this.getUserInfo.id === 1;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,8 +9,9 @@
|
|||||||
<div>第三方({{ oauthType }})登录成功,您还未绑定账号,请选择</div>
|
<div>第三方({{ oauthType }})登录成功,您还未绑定账号,请选择</div>
|
||||||
|
|
||||||
<div class="mt-10">
|
<div class="mt-10">
|
||||||
<a-button class="w-full mt-10" type="primary" @click="goBindUser">绑定已有账号</a-button>
|
<a-button v-if="!userStore.isLogined" class="w-full mt-10" type="primary" @click="goBindUser">绑定已有账号</a-button>
|
||||||
<a-button v-if="settingStore.sysPublic.registerEnabled" class="w-full mt-10" type="primary" @click="autoRegister">创建新账号</a-button>
|
<a-button v-else class="w-full mt-10" type="primary" @click="doBindCurrent">绑定当前登录账号({{ userStore.getUserInfo.username }} - {{ userStore.getUserInfo.nickName }})</a-button>
|
||||||
|
<a-button v-if="settingStore.sysPublic.registerEnabled" class="w-full mt-10" type="primary" @click="autoRegister">创建新账号绑定</a-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-full mt-10">
|
<div class="w-full mt-10">
|
||||||
@@ -63,6 +64,15 @@ async function handleOauthToken() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function doBindCurrent() {
|
||||||
|
await api.BindUser(validationCode);
|
||||||
|
notification.success({
|
||||||
|
message: "绑定成功",
|
||||||
|
});
|
||||||
|
//跳转到首页
|
||||||
|
router.replace("/certd/mine/user-profile");
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (error.value) {
|
if (error.value) {
|
||||||
return;
|
return;
|
||||||
@@ -70,12 +80,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
if (forType === "bind") {
|
if (forType === "bind") {
|
||||||
//从用户中心页面,进行第三方账号的绑定
|
//从用户中心页面,进行第三方账号的绑定
|
||||||
await api.BindUser(validationCode);
|
await doBindCurrent();
|
||||||
notification.success({
|
|
||||||
message: "绑定成功",
|
|
||||||
});
|
|
||||||
//跳转到首页
|
|
||||||
router.replace("/certd/mine/user-profile");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user