147 lines
4.6 KiB
Diff
147 lines
4.6 KiB
Diff
From f4d44578c8ba9a0b54f37da416469eb73b68f7a6 Mon Sep 17 00:00:00 2001
|
|
From: wkl505997900 <505997900@qq.com>
|
|
Date: Fri, 28 Apr 2023 10:22:34 +0800
|
|
Subject: [PATCH] add token exit interface and optimize Gitee authorization
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
---
|
|
src/api/login.js | 7 ++---
|
|
.../ant-design-pro/store/modules/user.js | 28 +++++++++++++------
|
|
src/views/leaks/HostLeakDetail.vue | 5 ++++
|
|
src/views/leaks/components/CvesTable.vue | 1 -
|
|
src/views/user/Account.vue | 9 +++++-
|
|
5 files changed, 35 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/src/api/login.js b/src/api/login.js
|
|
index 4bb4a2c..57d72f0 100644
|
|
--- a/src/api/login.js
|
|
+++ b/src/api/login.js
|
|
@@ -7,7 +7,7 @@ const userApi = {
|
|
LoginInGitee: '/manage/account/authredirecturl',
|
|
register: '/manage/account/add',
|
|
Login: '/manage/account/login',
|
|
- Logout: '/manage/logout',
|
|
+ Logout: '/manage/account/logout',
|
|
changePassword: '/manage/account/change',
|
|
certificateKey: '/manage/account/certificate'
|
|
};
|
|
@@ -101,10 +101,9 @@ export function certificateKey(parameter) {
|
|
});
|
|
}
|
|
|
|
-export function logout(parameter) {
|
|
+export function logout() {
|
|
return request({
|
|
url: userApi.Logout,
|
|
- method: 'post',
|
|
- data: parameter
|
|
+ method: 'post'
|
|
});
|
|
}
|
|
diff --git a/src/vendor/ant-design-pro/store/modules/user.js b/src/vendor/ant-design-pro/store/modules/user.js
|
|
index 505ce1c..908d1ef 100644
|
|
--- a/src/vendor/ant-design-pro/store/modules/user.js
|
|
+++ b/src/vendor/ant-design-pro/store/modules/user.js
|
|
@@ -4,7 +4,7 @@
|
|
|
|
import storage from 'store';
|
|
import cookie from 'js-cookie';
|
|
-import { login, refreshTokenFn } from '@/api/login';
|
|
+import { login, logout, refreshTokenFn } from '@/api/login';
|
|
import { ACCESS_TOKEN, REFRESH_TOKIN } from '@/vendor/ant-design-pro/store/mutation-types';
|
|
|
|
const user = {
|
|
@@ -122,14 +122,24 @@ const user = {
|
|
|
|
// 登出
|
|
Logout({ commit, state }) {
|
|
- commit('SET_TOKEN', '');
|
|
- commit('SET_ROLES', []);
|
|
- commit('SET_RETOKEN', []);
|
|
- storage.remove(ACCESS_TOKEN);
|
|
- storage.remove(REFRESH_TOKIN);
|
|
- cookie.remove('aops_token');
|
|
- cookie.remove('user_name');
|
|
- cookie.remove('refreshtoken');
|
|
+ return new Promise(resolve => {
|
|
+ logout()
|
|
+ .then(() => {
|
|
+ commit('SET_TOKEN', '');
|
|
+ commit('SET_ROLES', []);
|
|
+ commit('SET_RETOKEN', '');
|
|
+ storage.remove(ACCESS_TOKEN);
|
|
+ storage.remove(REFRESH_TOKIN);
|
|
+ cookie.remove('aops_token');
|
|
+ cookie.remove('user_name');
|
|
+ cookie.remove('refreshtoken');
|
|
+ resolve();
|
|
+ })
|
|
+ .catch(() => {
|
|
+ resolve();
|
|
+ })
|
|
+ .finally(() => { });
|
|
+ });
|
|
},
|
|
|
|
// 刷新token
|
|
diff --git a/src/views/leaks/HostLeakDetail.vue b/src/views/leaks/HostLeakDetail.vue
|
|
index 334f559..b0accc2 100644
|
|
--- a/src/views/leaks/HostLeakDetail.vue
|
|
+++ b/src/views/leaks/HostLeakDetail.vue
|
|
@@ -45,6 +45,7 @@
|
|
<a-card :bordered="false" class="aops-theme">
|
|
<h1>CVEs</h1>
|
|
<cves-table
|
|
+ ref="cve_table"
|
|
:inputList="cveList"
|
|
:inputLoading="cveIsLoading"
|
|
:hostList="[detail]"
|
|
@@ -202,6 +203,10 @@ export default {
|
|
.then(function (res) {
|
|
_this.$message.success(res.message);
|
|
_this.scanStatus = 3;
|
|
+ _this.$refs.cve_table.getCves();
|
|
+ setTimeout(() => {
|
|
+ _this.$refs.cve_table.getCvesAll();
|
|
+ }, 500);
|
|
_this.getScanStatue();
|
|
})
|
|
.catch(function (err) {
|
|
diff --git a/src/views/leaks/components/CvesTable.vue b/src/views/leaks/components/CvesTable.vue
|
|
index 1431cb6..35823d3 100644
|
|
--- a/src/views/leaks/components/CvesTable.vue
|
|
+++ b/src/views/leaks/components/CvesTable.vue
|
|
@@ -514,7 +514,6 @@ export default {
|
|
mounted() {
|
|
setTimeout(() => {
|
|
this.getCvesAll();
|
|
- console.log(11111)
|
|
}, 500);
|
|
this.getCves();
|
|
}
|
|
diff --git a/src/views/user/Account.vue b/src/views/user/Account.vue
|
|
index a1a2ea7..039bfbf 100644
|
|
--- a/src/views/user/Account.vue
|
|
+++ b/src/views/user/Account.vue
|
|
@@ -82,7 +82,14 @@ export default {
|
|
},
|
|
created() {
|
|
this.code = (window.location.search).split('=')[1];
|
|
- this.getConnection(this.code)
|
|
+ if (this.code === 'access_denied&error_description') {
|
|
+ // 拒绝授权,跳转登陆页
|
|
+ this.$message.info('拒绝授权!')
|
|
+ this.$router.push('/user/login')
|
|
+ } else {
|
|
+ // 同意授权,跳转首页
|
|
+ this.getConnection(this.code)
|
|
+ }
|
|
},
|
|
methods: {
|
|
...mapActions(['LoginInGitee']),
|
|
--
|
|
Gitee
|
|
|