src/Registration.js
/**
 * Starts either the ILAG or full registration flow, depending
 * on what the HS supports
 *
 * @param {object} options
 * @param {bool} options.go_home_on_cancel
 *     If true, goes to the home page if the user cancels the action
 * @param {bool} options.go_welcome_on_cancel
 *     If true, goes to the welcome page if the user cancels the action
 */
Starts either the ILAG or full registration flow, depending
on what the HS supports

@param {object} options
@param {bool} options.go_home_on_cancel
If true, goes to the home page if the user cancels the action
@param {bool} options.go_welcome_on_cancel
If true, goes to the welcome page if the user cancels the action
Starts either the ILAG or full registration flow depending on what the HS supports @param { object } options @param { bool } options . go_home_on_cancel If true goes to the home page if the user cancels the action @param { bool } options . go_welcome_on_cancel If true goes to the welcome page if the user cancels the action
async function startAnyRegistrationFlow(options) {
    if (options === undefined) options = {};
        const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
        Modal.createTrackedDialog('Registration required', '', QuestionDialog, {
            title: _t("Registration Required"),
            description: _t("You need to register to do this. Would you like to register now?"),
            button: _t("Register"),
            onFinished: (proceed) => {
                if (proceed) {
                    dis.dispatch({action: 'start_registration'});
                } else if (options.go_home_on_cancel) {
                    dis.dispatch({action: 'view_home_page'});
                } else if (options.go_welcome_on_cancel) {
                    dis.dispatch({action: 'start_login'});
                }
            },
        });
}
async function startAnyRegistrationFlow ( options ) { if ( options === undefined ) options = { } ; const QuestionDialog = sdk . getComponent ( "dialogs.QuestionDialog" ) ; Modal . createTrackedDialog ( 'Registration required' , '' , QuestionDialog , { title : _t ( "Registration Required" ) , description : _t ( "You need to register to do this. Would you like to register now?" ) , button : _t ( "Register" ) , onFinished : ( proceed ) => { if ( proceed ) { dis . dispatch ( { action : 'start_registration' } ) ; } else if ( options . go_home_on_cancel ) { dis . dispatch ( { action : 'view_home_page' } ) ; } else if ( options . go_welcome_on_cancel ) { dis . dispatch ( { action : 'start_login' } ) ; } } , } ) ; }
Starts either the ILAG or full registration flow, depending
 on what the HS supports
Starts either the ILAG or full registration flow depending on what the HS supports
// 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. // 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 { //}