Fix JWT token bugs.

This commit is contained in:
Yang Luo
2021-03-14 23:08:08 +08:00
parent f014554415
commit df948e9e34
6 changed files with 39 additions and 8 deletions

View File

@ -8,6 +8,7 @@
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"antd": "^4.7.2",
"copy-to-clipboard": "^3.3.1",
"i18next": "^19.8.9",
"moment": "^2.29.1",
"react": "^16.14.0",

View File

@ -17,6 +17,7 @@ import React from "react";
import {isMobile as isMobileDevice} from "react-device-detect";
import "./i18n";
import i18next from "i18next";
import copy from "copy-to-clipboard";
export let ServerUrl = "";
@ -151,3 +152,14 @@ export function changeLanguage(language) {
i18next.changeLanguage(language)
window.location.reload(true);
}
export function getClickable(text) {
return (
<a onClick={() => {
copy(text);
showMessage("success", `Copied to clipboard`);
}}>
{text}
</a>
)
}

View File

@ -130,6 +130,9 @@ class TokenListPage extends React.Component {
key: 'code',
// width: '150px',
sorter: (a, b) => a.code.localeCompare(b.code),
render: (text, record, index) => {
return Setting.getClickable(text);
}
},
{
title: i18next.t("token:Access Token"),
@ -137,6 +140,10 @@ class TokenListPage extends React.Component {
key: 'accessToken',
// width: '150px',
sorter: (a, b) => a.accessToken.localeCompare(b.accessToken),
ellipsis: true,
render: (text, record, index) => {
return Setting.getClickable(text);
}
},
{
title: i18next.t("token:Expires In"),

View File

@ -3387,6 +3387,13 @@ copy-to-clipboard@^3.2.0:
dependencies:
toggle-selection "^1.0.6"
copy-to-clipboard@^3.3.1:
version "3.3.1"
resolved "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==
dependencies:
toggle-selection "^1.0.6"
core-js-compat@^3.6.2:
version "3.6.5"
resolved "https://registry.npm.taobao.org/core-js-compat/download/core-js-compat-3.6.5.tgz#2a51d9a4e25dfd6e690251aa81f99e3c05481f1c"