Remove the accessToken from the URL. (#12353)

This commit is contained in:
HMYDK 2024-07-18 09:41:12 +08:00 committed by GitHub
parent 47d913de05
commit a6047fae45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 7 deletions

View File

@ -517,6 +517,7 @@ const request = (function(_global) {
const _LOGINPAGE_ENABLED = localStorage.getItem(LOGINPAGE_ENABLED); const _LOGINPAGE_ENABLED = localStorage.getItem(LOGINPAGE_ENABLED);
let accessTokenInHeader = '';
if (_LOGINPAGE_ENABLED !== 'false') { if (_LOGINPAGE_ENABLED !== 'false') {
let token = {}; let token = {};
try { try {
@ -526,7 +527,7 @@ const request = (function(_global) {
goLogin(); goLogin();
} }
const { accessToken = '' } = token; const { accessToken = '' } = token;
params.push(`accessToken=${accessToken}`); accessTokenInHeader = accessToken;
} }
return $.ajax( return $.ajax(
@ -540,6 +541,7 @@ const request = (function(_global) {
}, },
headers: { headers: {
Authorization: localStorage.getItem('token'), Authorization: localStorage.getItem('token'),
AccessToken: accessTokenInHeader,
}, },
}) })
).then( ).then(

View File

@ -49,7 +49,6 @@ const request = () => {
goLogin(); goLogin();
} }
const { accessToken = '', username = '' } = token; const { accessToken = '', username = '' } = token;
config.params.accessToken = accessToken;
// support #3548 and fix #5835 // support #3548 and fix #5835
if (!url.includes('auth')) { if (!url.includes('auth')) {
config.params.username = username; config.params.username = username;

View File

@ -35,7 +35,7 @@
<link rel="stylesheet" type="text/css" href="console-ui/public/css/icon.css"> <link rel="stylesheet" type="text/css" href="console-ui/public/css/icon.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/font-awesome.css"> <link rel="stylesheet" type="text/css" href="console-ui/public/css/font-awesome.css">
<!-- 第三方css结束 --> <!-- 第三方css结束 -->
<link href="./css/main.css?50300f41fe7e73539edb" rel="stylesheet"></head> <link href="./css/main.css?ae6bcb8479aa5e5c3c24" rel="stylesheet"></head>
<body> <body>
<div id="root" style="overflow:hidden"></div> <div id="root" style="overflow:hidden"></div>
@ -56,6 +56,6 @@
<script src="console-ui/public/js/merge.js"></script> <script src="console-ui/public/js/merge.js"></script>
<script src="console-ui/public/js/loader.js"></script> <script src="console-ui/public/js/loader.js"></script>
<!-- 第三方js结束 --> <!-- 第三方js结束 -->
<script type="text/javascript" src="./js/main.js?50300f41fe7e73539edb"></script></body> <script type="text/javascript" src="./js/main.js?ae6bcb8479aa5e5c3c24"></script></body>
</html> </html>

File diff suppressed because one or more lines are too long