|
@@ -21,6 +21,7 @@ export default class AdminGithubSecurityContainer extends Container {
|
|
|
|
|
|
|
|
this.state = {
|
|
this.state = {
|
|
|
appSiteUrl: urljoin(pathUtils.removeTrailingSlash(appContainer.config.crowi.url), '/passport/github/callback'),
|
|
appSiteUrl: urljoin(pathUtils.removeTrailingSlash(appContainer.config.crowi.url), '/passport/github/callback'),
|
|
|
|
|
+ isGitHubStrategySetup: false,
|
|
|
githubClientId: '',
|
|
githubClientId: '',
|
|
|
githubClientSecret: '',
|
|
githubClientSecret: '',
|
|
|
isSameUsernameTreatedAsIdenticalUser: true,
|
|
isSameUsernameTreatedAsIdenticalUser: true,
|
|
@@ -35,6 +36,7 @@ export default class AdminGithubSecurityContainer extends Container {
|
|
|
const response = await this.appContainer.apiv3.get('/security-setting/');
|
|
const response = await this.appContainer.apiv3.get('/security-setting/');
|
|
|
const { githubOAuth } = response.data.securityParams;
|
|
const { githubOAuth } = response.data.securityParams;
|
|
|
this.setState({
|
|
this.setState({
|
|
|
|
|
+ isGitHubStrategySetup: githubOAuth.isGitHubStrategySetup,
|
|
|
githubClientId: githubOAuth.githubClientId || '',
|
|
githubClientId: githubOAuth.githubClientId || '',
|
|
|
githubClientSecret: githubOAuth.githubClientSecret || '',
|
|
githubClientSecret: githubOAuth.githubClientSecret || '',
|
|
|
isSameUsernameTreatedAsIdenticalUser: githubOAuth.isSameUsernameTreatedAsIdenticalUser || false,
|
|
isSameUsernameTreatedAsIdenticalUser: githubOAuth.isSameUsernameTreatedAsIdenticalUser || false,
|
|
@@ -72,19 +74,21 @@ export default class AdminGithubSecurityContainer extends Container {
|
|
|
/**
|
|
/**
|
|
|
* Update githubSetting
|
|
* Update githubSetting
|
|
|
*/
|
|
*/
|
|
|
- async updateGitHubSetting(isGithubOAuthEnabled) {
|
|
|
|
|
|
|
+ async updateGitHubSetting() {
|
|
|
|
|
|
|
|
const response = await this.appContainer.apiv3.put('/security-setting/github-oauth', {
|
|
const response = await this.appContainer.apiv3.put('/security-setting/github-oauth', {
|
|
|
- isGithubOAuthEnabled,
|
|
|
|
|
githubClientId: this.state.githubClientId,
|
|
githubClientId: this.state.githubClientId,
|
|
|
githubClientSecret: this.state.githubClientSecret,
|
|
githubClientSecret: this.state.githubClientSecret,
|
|
|
isSameUsernameTreatedAsIdenticalUser: this.state.isSameUsernameTreatedAsIdenticalUser,
|
|
isSameUsernameTreatedAsIdenticalUser: this.state.isSameUsernameTreatedAsIdenticalUser,
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ const { securitySettingParams } = response.data;
|
|
|
|
|
+
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- githubClientId: this.state.githubClientId,
|
|
|
|
|
- githubClientSecret: this.state.githubClientSecret,
|
|
|
|
|
- isSameUsernameTreatedAsIdenticalUser: this.state.isSameUsernameTreatedAsIdenticalUser,
|
|
|
|
|
|
|
+ isGitHubStrategySetup: securitySettingParams.isGitHubStrategySetup,
|
|
|
|
|
+ githubClientId: securitySettingParams.githubClientId,
|
|
|
|
|
+ githubClientSecret: securitySettingParams.githubClientSecret,
|
|
|
|
|
+ isSameUsernameTreatedAsIdenticalUser: securitySettingParams.isSameUsernameTreatedAsIdenticalUser,
|
|
|
});
|
|
});
|
|
|
return response;
|
|
return response;
|
|
|
}
|
|
}
|