disable ilag

This commit is contained in:
Bruno Windels 2019-01-30 13:13:09 +01:00
parent 3e7c3bfff8
commit a0d44003e4
2 changed files with 49 additions and 40 deletions

View file

@ -40,25 +40,29 @@ export const SAFE_LOCALPART_REGEX = /^[a-z0-9=_\-./]+$/;
*/ */
export async function startAnyRegistrationFlow(options) { export async function startAnyRegistrationFlow(options) {
if (options === undefined) options = {}; if (options === undefined) options = {};
const flows = await _getRegistrationFlows();
// look for an ILAG compatible flow. We define this as one // look for an ILAG compatible flow. We define this as one
// which has only dummy or recaptcha flows. In practice it // which has only dummy or recaptcha flows. In practice it
// would support any stage InteractiveAuth supports, just not // would support any stage InteractiveAuth supports, just not
// ones like email & msisdn which require the user to supply // ones like email & msisdn which require the user to supply
// the relevant details in advance. We err on the side of // the relevant details in advance. We err on the side of
// caution though. // caution though.
const hasIlagFlow = flows.some((flow) => {
return flow.stages.every((stage) => {
return ['m.login.dummy', 'm.login.recaptcha', 'm.login.terms'].includes(stage);
});
});
if (hasIlagFlow) { // XXX: ILAG is disabled for now,
dis.dispatch({ // see https://github.com/vector-im/riot-web/issues/8222
action: 'view_set_mxid',
go_home_on_cancel: options.go_home_on_cancel, // const flows = await _getRegistrationFlows();
}); // const hasIlagFlow = flows.some((flow) => {
} else { // return flow.stages.every((stage) => {
// return ['m.login.dummy', 'm.login.recaptcha', 'm.login.terms'].includes(stage);
// });
// });
// if (hasIlagFlow) {
// dis.dispatch({
// action: 'view_set_mxid',
// go_home_on_cancel: options.go_home_on_cancel,
// });
//} else {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createTrackedDialog('Registration required', '', QuestionDialog, { Modal.createTrackedDialog('Registration required', '', QuestionDialog, {
title: _t("Registration Required"), title: _t("Registration Required"),
@ -72,7 +76,7 @@ export async function startAnyRegistrationFlow(options) {
} }
}, },
}); });
} //}
} }
async function _getRegistrationFlows() { async function _getRegistrationFlows() {

View file

@ -899,35 +899,40 @@ module.exports = React.createClass({
// Don't peek whilst registering otherwise getPendingEventList complains // Don't peek whilst registering otherwise getPendingEventList complains
// Do this by indicating our intention to join // Do this by indicating our intention to join
dis.dispatch({
action: 'will_join',
});
const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog'); // XXX: ILAG is disabled for now,
const close = Modal.createTrackedDialog('Set MXID', '', SetMxIdDialog, { // see https://github.com/vector-im/riot-web/issues/8222
homeserverUrl: cli.getHomeserverUrl(), dis.dispatch({action: 'require_registration'});
onFinished: (submitted, credentials) => {
if (submitted) {
this.props.onRegistered(credentials);
} else {
dis.dispatch({
action: 'cancel_after_sync_prepared',
});
dis.dispatch({
action: 'cancel_join',
});
}
},
onDifferentServerClicked: (ev) => {
dis.dispatch({action: 'start_registration'});
close();
},
onLoginClick: (ev) => {
dis.dispatch({action: 'start_login'});
close();
},
}).close;
return; return;
// dis.dispatch({
// action: 'will_join',
// });
// const SetMxIdDialog = sdk.getComponent('views.dialogs.SetMxIdDialog');
// const close = Modal.createTrackedDialog('Set MXID', '', SetMxIdDialog, {
// homeserverUrl: cli.getHomeserverUrl(),
// onFinished: (submitted, credentials) => {
// if (submitted) {
// this.props.onRegistered(credentials);
// } else {
// dis.dispatch({
// action: 'cancel_after_sync_prepared',
// });
// dis.dispatch({
// action: 'cancel_join',
// });
// }
// },
// onDifferentServerClicked: (ev) => {
// dis.dispatch({action: 'start_registration'});
// close();
// },
// onLoginClick: (ev) => {
// dis.dispatch({action: 'start_login'});
// close();
// },
// }).close;
// return;
} }
Promise.resolve().then(() => { Promise.resolve().then(() => {