From a0d44003e4eb2ee1d900622542fa335b1382ac84 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 30 Jan 2019 13:13:09 +0100 Subject: [PATCH 1/4] disable ilag --- src/Registration.js | 30 ++++++++------ src/components/structures/RoomView.js | 59 +++++++++++++++------------ 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/Registration.js b/src/Registration.js index 98aee3ac83..8b43b28817 100644 --- a/src/Registration.js +++ b/src/Registration.js @@ -40,25 +40,29 @@ export const SAFE_LOCALPART_REGEX = /^[a-z0-9=_\-./]+$/; */ export async function startAnyRegistrationFlow(options) { if (options === undefined) options = {}; - const flows = await _getRegistrationFlows(); // look for an ILAG compatible flow. We define this as one // which has only dummy or recaptcha flows. In practice it // would support any stage InteractiveAuth supports, just not // ones like email & msisdn which require the user to supply // the relevant details in advance. We err on the side of // 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) { - dis.dispatch({ - action: 'view_set_mxid', - go_home_on_cancel: options.go_home_on_cancel, - }); - } else { + // XXX: ILAG is disabled for now, + // see https://github.com/vector-im/riot-web/issues/8222 + + // const flows = await _getRegistrationFlows(); + // const hasIlagFlow = flows.some((flow) => { + // 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"); Modal.createTrackedDialog('Registration required', '', QuestionDialog, { title: _t("Registration Required"), @@ -72,7 +76,7 @@ export async function startAnyRegistrationFlow(options) { } }, }); - } + //} } async function _getRegistrationFlows() { diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 6c17aa415a..265e4db4b4 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -899,35 +899,40 @@ module.exports = React.createClass({ // Don't peek whilst registering otherwise getPendingEventList complains // Do this by indicating our intention to join - 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; + // XXX: ILAG is disabled for now, + // see https://github.com/vector-im/riot-web/issues/8222 + dis.dispatch({action: 'require_registration'}); 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(() => { From 5ac0e6ba074caefb283e9203bcb0ecbbe4d5fb93 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 30 Jan 2019 15:45:42 +0100 Subject: [PATCH 2/4] replace join_room by view_room as deferred action, as join_room doens't change the page type in matrixchat --- src/components/structures/RoomView.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 265e4db4b4..01df8272fa 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -892,8 +892,8 @@ module.exports = React.createClass({ dis.dispatch({ action: 'do_after_sync_prepared', deferred_action: { - action: 'join_room', - opts: { inviteSignUrl: signUrl, viaServers: this.props.viaServers }, + action: 'view_room', + room_id: this.state.room.roomId, }, }); @@ -903,7 +903,6 @@ module.exports = React.createClass({ // XXX: ILAG is disabled for now, // see https://github.com/vector-im/riot-web/issues/8222 dis.dispatch({action: 'require_registration'}); - return; // dis.dispatch({ // action: 'will_join', // }); @@ -933,17 +932,18 @@ module.exports = React.createClass({ // }, // }).close; // return; + } else { + Promise.resolve().then(() => { + const signUrl = this.props.thirdPartyInvite ? + this.props.thirdPartyInvite.inviteSignUrl : undefined; + dis.dispatch({ + action: 'join_room', + opts: { inviteSignUrl: signUrl, viaServers: this.props.viaServers }, + }); + return Promise.resolve(); + }); } - Promise.resolve().then(() => { - const signUrl = this.props.thirdPartyInvite ? - this.props.thirdPartyInvite.inviteSignUrl : undefined; - dis.dispatch({ - action: 'join_room', - opts: { inviteSignUrl: signUrl, viaServers: this.props.viaServers }, - }); - return Promise.resolve(); - }); }, onMessageListScroll: function(ev) { From b90ca50e1d4496afeb08fea7fe189fc7df482b22 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 30 Jan 2019 17:08:34 +0100 Subject: [PATCH 3/4] comment out unused function to appease linter --- src/Registration.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Registration.js b/src/Registration.js index 8b43b28817..1f0815e028 100644 --- a/src/Registration.js +++ b/src/Registration.js @@ -79,22 +79,22 @@ export async function startAnyRegistrationFlow(options) { //} } -async function _getRegistrationFlows() { - try { - await MatrixClientPeg.get().register( - null, - null, - undefined, - {}, - {}, - ); - console.log("Register request succeeded when it should have returned 401!"); - } catch (e) { - if (e.httpStatus === 401) { - return e.data.flows; - } - throw e; - } - throw new Error("Register request succeeded when it should have returned 401!"); -} +// async function _getRegistrationFlows() { +// try { +// await MatrixClientPeg.get().register( +// null, +// null, +// undefined, +// {}, +// {}, +// ); +// console.log("Register request succeeded when it should have returned 401!"); +// } catch (e) { +// if (e.httpStatus === 401) { +// return e.data.flows; +// } +// throw e; +// } +// throw new Error("Register request succeeded when it should have returned 401!"); +// } From af9d572545e2d52f992beeae821746e56564ebc1 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 30 Jan 2019 18:30:01 +0100 Subject: [PATCH 4/4] more lint fixing --- src/Registration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Registration.js b/src/Registration.js index 1f0815e028..f3a2076ed6 100644 --- a/src/Registration.js +++ b/src/Registration.js @@ -22,9 +22,9 @@ limitations under the License. import dis from './dispatcher'; import sdk from './index'; -import MatrixClientPeg from './MatrixClientPeg'; import Modal from './Modal'; import { _t } from './languageHandler'; +// import MatrixClientPeg from './MatrixClientPeg'; // Regex for what a "safe" or "Matrix-looking" localpart would be. // TODO: Update as needed for https://github.com/matrix-org/matrix-doc/issues/1514