Use providerItem.canUnbind

This commit is contained in:
Yang Luo
2021-06-14 23:53:43 +08:00
parent 985205a978
commit 7871541cd5

View File

@ -128,7 +128,7 @@ class UserEditPage extends React.Component {
return this.state.user.properties[key] return this.state.user.properties[key]
} }
renderIdp(provider) { renderIdp(providerItem, provider) {
const linkedValue = this.state.user[provider.type.toLowerCase()]; const linkedValue = this.state.user[provider.type.toLowerCase()];
const profileUrl = this.getProviderLink(provider); const profileUrl = this.getProviderLink(provider);
const id = this.getUserProperty(provider.type, "id"); const id = this.getUserProperty(provider.type, "id");
@ -187,7 +187,7 @@ class UserEditPage extends React.Component {
<Button style={{marginLeft: '20px', width: '80px'}} type="primary">{i18next.t("user:Link")}</Button> <Button style={{marginLeft: '20px', width: '80px'}} type="primary">{i18next.t("user:Link")}</Button>
</a> </a>
) : ( ) : (
<Button style={{marginLeft: '20px', width: '80px'}} onClick={() => this.unlinkUser(provider.type)}>{i18next.t("user:Unlink")}</Button> <Button disabled={!providerItem.canUnbind} style={{marginLeft: '20px', width: '80px'}} onClick={() => this.unlinkUser(provider.type)}>{i18next.t("user:Unlink")}</Button>
) )
} }
</Col> </Col>
@ -344,7 +344,7 @@ class UserEditPage extends React.Component {
<Col span={22} > <Col span={22} >
<div style={{marginBottom: 20}}> <div style={{marginBottom: 20}}>
{ {
this.state.application?.providers.filter(providerItem => Setting.isProviderVisible(providerItem)).map((providerItem, index) => this.renderIdp(providerItem.provider)) this.state.application?.providers.filter(providerItem => Setting.isProviderVisible(providerItem)).map((providerItem, index) => this.renderIdp(providerItem, providerItem.provider))
} }
</div> </div>
</Col> </Col>