feat: add token to the page for Chrome extension (#2804)

* feat: add token to the page for Chrome extension

* Update token_oauth.go

---------

Co-authored-by: Eric Luo <hsluoyz@qq.com>
This commit is contained in:
SamYSF
2024-03-17 22:01:28 +08:00
committed by GitHub
parent 6037f37b87
commit c8aa35c9c6
6 changed files with 59 additions and 0 deletions

View File

@ -51,6 +51,7 @@ class App extends Component {
classes: props,
selectedMenuKey: 0,
account: undefined,
accessToken: undefined,
uri: null,
themeAlgorithm: storageThemeAlgorithm,
themeData: Conf.ThemeDefault,
@ -228,9 +229,11 @@ class App extends Component {
AuthBackend.getAccount(query)
.then((res) => {
let account = null;
let accessToken = null;
if (res.status === "ok") {
account = res.data;
account.organization = res.data2;
accessToken = res.data.accessToken;
this.setLanguage(account);
this.setTheme(Setting.getThemeData(account.organization), Conf.InitThemeAlgorithm);
@ -242,6 +245,7 @@ class App extends Component {
this.setState({
account: account,
accessToken: accessToken,
});
});
}
@ -256,6 +260,7 @@ class App extends Component {
return (
<React.Fragment>
{!this.state.account ? null : <div style={{display: "none"}} id="CasdoorApplicationName" value={this.state.account.signupApplication} />}
{!this.state.account ? null : <div style={{display: "none"}} id="CasdoorAccessToken" value={this.state.accessToken} />}
<Footer id="footer" style={
{
textAlign: "center",