Show change warning only when different from current
This commit is contained in:
parent
19fff51b01
commit
df03477907
1 changed files with 8 additions and 6 deletions
|
@ -147,10 +147,11 @@ export default class SetIdServer extends React.Component {
|
||||||
|
|
||||||
_checkIdServer = async (e) => {
|
_checkIdServer = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
const { idServer, currentClientIdServer } = this.state;
|
||||||
|
|
||||||
this.setState({busy: true, checking: true, error: null});
|
this.setState({busy: true, checking: true, error: null});
|
||||||
|
|
||||||
const fullUrl = unabbreviateUrl(this.state.idServer);
|
const fullUrl = unabbreviateUrl(idServer);
|
||||||
|
|
||||||
let errStr = await checkIdentityServerUrl(fullUrl);
|
let errStr = await checkIdentityServerUrl(fullUrl);
|
||||||
if (!errStr) {
|
if (!errStr) {
|
||||||
|
@ -179,25 +180,26 @@ export default class SetIdServer extends React.Component {
|
||||||
|
|
||||||
if (!terms || !terms["policies"] || Object.keys(terms["policies"]).length <= 0) {
|
if (!terms || !terms["policies"] || Object.keys(terms["policies"]).length <= 0) {
|
||||||
const [confirmed] = await this._showNoTermsWarning(fullUrl);
|
const [confirmed] = await this._showNoTermsWarning(fullUrl);
|
||||||
save &= confirmed;
|
save = confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show a general warning, possibly with details about any bound
|
// Show a general warning, possibly with details about any bound
|
||||||
// 3PIDs that would be left behind.
|
// 3PIDs that would be left behind.
|
||||||
if (save && this.state.currentClientIdServer) {
|
console.log(fullUrl, idServer, currentClientIdServer)
|
||||||
|
if (save && currentClientIdServer && fullUrl !== currentClientIdServer) {
|
||||||
const [confirmed] = await this._showServerChangeWarning({
|
const [confirmed] = await this._showServerChangeWarning({
|
||||||
title: _t("Change identity server"),
|
title: _t("Change identity server"),
|
||||||
unboundMessage: _t(
|
unboundMessage: _t(
|
||||||
"Disconnect from the identity server <current /> and " +
|
"Disconnect from the identity server <current /> and " +
|
||||||
"connect to <new /> instead?", {},
|
"connect to <new /> instead?", {},
|
||||||
{
|
{
|
||||||
current: sub => <b>{abbreviateUrl(this.state.currentClientIdServer)}</b>,
|
current: sub => <b>{abbreviateUrl(currentClientIdServer)}</b>,
|
||||||
new: sub => <b>{abbreviateUrl(this.state.idServer)}</b>,
|
new: sub => <b>{abbreviateUrl(idServer)}</b>,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
button: _t("Continue"),
|
button: _t("Continue"),
|
||||||
});
|
});
|
||||||
save &= confirmed;
|
save = confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save) {
|
if (save) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue