Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(authentication): Fixes web login dialog to connect and join.

damenchoc58e557019e2
diff --git a/react/features/authentication/components/web/LoginDialog.tsx b/react/features/authentication/components/web/LoginDialog.tsx
index 00ff3de22a..a6bc3425fb 100644
--- a/react/features/authentication/components/web/LoginDialog.tsx
+++ b/react/features/authentication/components/web/LoginDialog.tsx
@@ -5,12 +5,12 @@ import { connect as reduxConnect } from 'react-redux';
import { IReduxState, IStore } from '../../../app/types';
import { IJitsiConference } from '../../../base/conference/reducer';
import { IConfig } from '../../../base/config/configType';
-import { connect } from '../../../base/connection/actions.web';
import { toJid } from '../../../base/connection/functions';
import { translate, translateToHTML } from '../../../base/i18n/functions';
import { JitsiConnectionErrors } from '../../../base/lib-jitsi-meet';
import Dialog from '../../../base/ui/components/web/Dialog';
import Input from '../../../base/ui/components/web/Input';
+import { joinConference } from '../../../prejoin/actions.web';
import {
authenticateAndUpgradeRole,
cancelLogin
@@ -134,7 +134,9 @@ class LoginDialog extends Component<IProps, IState> {
if (conference) {
dispatch(authenticateAndUpgradeRole(jid, password, conference));
} else {
- dispatch(connect(jid, password));
+ // dispatch(connect(jid, password));
+ // FIXME: Workaround for the web version. To be removed once we get rid of conference.js
+ dispatch(joinConference(undefined, false, jid, password));
}
}
diff --git a/react/features/base/conference/middleware.any.ts b/react/features/base/conference/middleware.any.ts
index 7e528c6b67..94dea14774 100644
--- a/react/features/base/conference/middleware.any.ts
+++ b/react/features/base/conference/middleware.any.ts
@@ -24,7 +24,7 @@ import { overwriteConfig } from '../config/actions';
import { CONNECTION_ESTABLISHED, CONNECTION_FAILED } from '../connection/actionTypes';
import { connect, connectionDisconnected, disconnect } from '../connection/actions';
import { validateJwt } from '../jwt/functions';
-import { JitsiConferenceErrors } from '../lib-jitsi-meet';
+import { JitsiConferenceErrors, JitsiConnectionErrors } from '../lib-jitsi-meet';
import { PARTICIPANT_UPDATED, PIN_PARTICIPANT } from '../participants/actionTypes';
import { PARTICIPANT_ROLE } from '../participants/constants';
import {
@@ -392,18 +392,22 @@ function _logJwtErrors(message: string, state: IReduxState) {
function _connectionFailed({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
_logJwtErrors(action.error.message, getState());
- dispatch(showErrorNotification({
- descriptionKey: 'dialog.tokenAuthFailed',
- titleKey: 'dialog.tokenAuthFailedTitle'
- }, NOTIFICATION_TIMEOUT_TYPE.LONG));
+ const { connection, error } = action;
+
+ // do not show the notification when we will prompt the user
+ // for username and password
+ if (error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
+ && getState()['features/base/jwt'].jwt) {
+ dispatch(showErrorNotification({
+ descriptionKey: 'dialog.tokenAuthFailed',
+ titleKey: 'dialog.tokenAuthFailedTitle'
+ }, NOTIFICATION_TIMEOUT_TYPE.LONG));
+ }
const result = next(action);
_removeUnloadHandler(getState);
- const { connection } = action;
- const { error } = action;
-
forEachConference(getState, conference => {
// TODO: revisit this
// It feels that it would make things easier if JitsiConference
diff --git a/react/features/prejoin/actions.web.ts b/react/features/prejoin/actions.web.ts
index fa10c8396c..59a7c575fc 100644
--- a/react/features/prejoin/actions.web.ts
+++ b/react/features/prejoin/actions.web.ts
@@ -211,9 +211,12 @@ export function initPrejoin(tracks: Object[], errors: Object) {
*
* @param {Object} options - The config options that override the default ones (if any).
* @param {boolean} ignoreJoiningInProgress - If true we won't check the joiningInProgress flag.
+ * @param {string?} jid - The XMPP user's ID (e.g. {@code [email protected]}).
+ * @param {string?} password - The XMPP user's password.
* @returns {Function}
*/
-export function joinConference(options?: Object, ignoreJoiningInProgress = false) {
+export function joinConference(options?: Object, ignoreJoiningInProgress = false,
+ jid?: string, password?: string) {
return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) {
if (!ignoreJoiningInProgress) {
const state = getState();
@@ -228,7 +231,7 @@ export function joinConference(options?: Object, ignoreJoiningInProgress = false
options && dispatch(updateConfig(options));
- dispatch(connect()).then(async () => {
+ dispatch(connect(jid, password)).then(async () => {
// TODO keep this here till we move tracks and conference management from
// conference.js to react.
const state = getState();