fxlwpy2000
fxlwpy2000
采纳率0%
2018-03-30 03:28 浏览 3.8k

jitsi meet源码中,在登录界面提交登录信息的代码处理

5

登录jitsimeet,在登录界面填写用户名和密码后,压下OK键,进入jitsimeet。
如下代码为压下OK按键的代码:

    _onLogin() {
        const { _conference: conference, dispatch } = this.props;
        const { password, username } = this.state;
        const jid = toJid(username, this.props._configHosts);
        let r;

        // If there's a conference it means that the connection has succeeded,
        // but authentication is required in order to join the room.
        if (conference) {
            r = dispatch(authenticateAndUpgradeRole(jid, password, conference));
        } else {
            r = dispatch(connect(jid, password));
        }

        return r;
    }
    
<pre>
    export function authenticateAndUpgradeRole(
    id: string,
    password: string,
    conference: Object) {
return (dispatch: Dispatch, getState: Function) => {
    const { password: roomPassword }
        = getState()['features/base/conference'];
    const process
        = conference.authenticateAndUpgradeRole({
            id,
            password,
            roomPassword,

            onLoginSuccessful() {
                // When the login succeeds, the process has completed half
                // of its job (i.e. 0.5).
                return dispatch(_upgradeRoleFinished(process, 0.5));
            }
        });

    dispatch(_upgradeRoleStarted(process));
    process.then(
        /* onFulfilled */ () => dispatch(_upgradeRoleFinished(process, 1)),
        /* onRejected */ error => {
            // The lack of an error signals a cancellation.
            if (error.authenticationError || error.connectionError) {
                logger.error('authenticateAndUpgradeRole failed', error);
            }

            dispatch(_upgradeRoleFinished(process, error));
        });

    return process;
};

}


在authenticateAndUpgradeRole函数中,如下代码段

        const process
            = conference.authenticateAndUpgradeRole({
                id,
                password,
                roomPassword,

                onLoginSuccessful() {
                    // When the login succeeds, the process has completed half
                    // of its job (i.e. 0.5).
                    return dispatch(_upgradeRoleFinished(process, 0.5));
                }
            });
    

其中的conference.authenticateAndUpgradeRole应该实现的是用户名和密码的验证功能,但是我在源码工程中没有找到该接口的定义,请大神指教上述代码段的功能,以及如何能够找到提交登录信息后,是如何验证用户名和密码的?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答 默认 最新

相关推荐