mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 18:54:03 +08:00
Improve termsOfUse UI and error handling
This commit is contained in:
parent
ca6b27f922
commit
3459ef1479
@ -542,7 +542,7 @@ class ApplicationEditPage extends React.Component {
|
|||||||
{Setting.getLabel(i18next.t("signup:Terms of Use"), i18next.t("signup:Terms of Use - Tooltip"))} :
|
{Setting.getLabel(i18next.t("signup:Terms of Use"), i18next.t("signup:Terms of Use - Tooltip"))} :
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={22} >
|
<Col span={22} >
|
||||||
<Input value={this.state.application.termsOfUse} style={{marginBottom: "10px"}} onChange={e => {
|
<Input prefix={<LinkOutlined />} value={this.state.application.termsOfUse} style={{marginBottom: "10px"}} onChange={e => {
|
||||||
this.updateApplicationField("termsOfUse", e.target.value);
|
this.updateApplicationField("termsOfUse", e.target.value);
|
||||||
}} />
|
}} />
|
||||||
<Upload maxCount={1} accept=".html" showUploadList={false}
|
<Upload maxCount={1} accept=".html" showUploadList={false}
|
||||||
|
@ -50,11 +50,15 @@ window.fetch = async(url, option = {}) => {
|
|||||||
requestFilters.forEach(filter => filter(url, option));
|
requestFilters.forEach(filter => filter(url, option));
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
originalFetch(url, option).then(res => {
|
originalFetch(url, option)
|
||||||
|
.then(res => {
|
||||||
if (!url.startsWith("/api/get-organizations")) {
|
if (!url.startsWith("/api/get-organizations")) {
|
||||||
responseFilters.forEach(filter => filter(res.clone()));
|
responseFilters.forEach(filter => filter(res.clone()));
|
||||||
}
|
}
|
||||||
resolve(res);
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,11 @@ export const AgreementModal = (props) => {
|
|||||||
function getTermsOfUseContent(url) {
|
function getTermsOfUseContent(url) {
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
}).then(r => r.text());
|
})
|
||||||
|
.then(r => r.text())
|
||||||
|
.catch(error => {
|
||||||
|
Setting.showMessage("error", `${i18next.t("general:Failed to get TermsOfUse URL")}: ${url}, ${error}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isAgreementRequired(application) {
|
export function isAgreementRequired(application) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user