Merge pull request #3344 from matrix-org/travis/fix-is-terms
Treat 404 errors on IS as having no terms
This commit is contained in:
commit
f4ca91d4d3
2 changed files with 28 additions and 20 deletions
|
@ -153,6 +153,30 @@ export default class SetIdServer extends React.Component {
|
||||||
// Double check that the identity server even has terms of service.
|
// Double check that the identity server even has terms of service.
|
||||||
const terms = await MatrixClientPeg.get().getTerms(SERVICE_TYPES.IS, fullUrl);
|
const terms = await MatrixClientPeg.get().getTerms(SERVICE_TYPES.IS, fullUrl);
|
||||||
if (!terms || !terms["policies"] || Object.keys(terms["policies"]).length <= 0) {
|
if (!terms || !terms["policies"] || Object.keys(terms["policies"]).length <= 0) {
|
||||||
|
this._showNoTermsWarning(fullUrl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._saveIdServer(fullUrl);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
if (e.cors === "rejected" || e.httpStatus === 404) {
|
||||||
|
this._showNoTermsWarning(fullUrl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
errStr = _t("Terms of service not accepted or the identity server is invalid.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
busy: false,
|
||||||
|
checking: false,
|
||||||
|
error: errStr,
|
||||||
|
currentClientIdServer: MatrixClientPeg.get().getIdentityServerUrl(),
|
||||||
|
idServer: this.state.idServer,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
_showNoTermsWarning(fullUrl) {
|
||||||
const QuestionDialog = sdk.getComponent("views.dialogs.QuestionDialog");
|
const QuestionDialog = sdk.getComponent("views.dialogs.QuestionDialog");
|
||||||
Modal.createTrackedDialog('No Terms Warning', '', QuestionDialog, {
|
Modal.createTrackedDialog('No Terms Warning', '', QuestionDialog, {
|
||||||
title: _t("Identity server has no terms of service"),
|
title: _t("Identity server has no terms of service"),
|
||||||
|
@ -172,24 +196,8 @@ export default class SetIdServer extends React.Component {
|
||||||
this._saveIdServer(fullUrl);
|
this._saveIdServer(fullUrl);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._saveIdServer(fullUrl);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
errStr = _t("Terms of service not accepted or the identity server is invalid.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
busy: false,
|
|
||||||
checking: false,
|
|
||||||
error: errStr,
|
|
||||||
currentClientIdServer: MatrixClientPeg.get().getIdentityServerUrl(),
|
|
||||||
idServer: this.state.idServer,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
_onDisconnectClicked = async () => {
|
_onDisconnectClicked = async () => {
|
||||||
this.setState({disconnectBusy: true});
|
this.setState({disconnectBusy: true});
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -549,10 +549,10 @@
|
||||||
"Not a valid Identity Server (status code %(code)s)": "Not a valid Identity Server (status code %(code)s)",
|
"Not a valid Identity Server (status code %(code)s)": "Not a valid Identity Server (status code %(code)s)",
|
||||||
"Could not connect to Identity Server": "Could not connect to Identity Server",
|
"Could not connect to Identity Server": "Could not connect to Identity Server",
|
||||||
"Checking server": "Checking server",
|
"Checking server": "Checking server",
|
||||||
|
"Terms of service not accepted or the identity server is invalid.": "Terms of service not accepted or the identity server is invalid.",
|
||||||
"Identity server has no terms of service": "Identity server has no terms of service",
|
"Identity server has no terms of service": "Identity server has no terms of service",
|
||||||
"The identity server you have chosen does not have any terms of service.": "The identity server you have chosen does not have any terms of service.",
|
"The identity server you have chosen does not have any terms of service.": "The identity server you have chosen does not have any terms of service.",
|
||||||
"Only continue if you trust the owner of the server.": "Only continue if you trust the owner of the server.",
|
"Only continue if you trust the owner of the server.": "Only continue if you trust the owner of the server.",
|
||||||
"Terms of service not accepted or the identity server is invalid.": "Terms of service not accepted or the identity server is invalid.",
|
|
||||||
"You are currently sharing email addresses or phone numbers on the identity server <idserver />. You will need to reconnect to <idserver2 /> to stop sharing them.": "You are currently sharing email addresses or phone numbers on the identity server <idserver />. You will need to reconnect to <idserver2 /> to stop sharing them.",
|
"You are currently sharing email addresses or phone numbers on the identity server <idserver />. You will need to reconnect to <idserver2 /> to stop sharing them.": "You are currently sharing email addresses or phone numbers on the identity server <idserver />. You will need to reconnect to <idserver2 /> to stop sharing them.",
|
||||||
"Disconnect from the identity server <idserver />?": "Disconnect from the identity server <idserver />?",
|
"Disconnect from the identity server <idserver />?": "Disconnect from the identity server <idserver />?",
|
||||||
"Disconnect Identity Server": "Disconnect Identity Server",
|
"Disconnect Identity Server": "Disconnect Identity Server",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue