Skip to content

Commit

Permalink
fix: Fixes #10796 authentication in conference. (#10848)
Browse files Browse the repository at this point in the history
* fix: Fixes #10796 authentication in conference.

* fixup!

* fixup2!

Co-authored-by: Saúl Ibarra Corretgé <saghul@jitsi.org>
  • Loading branch information
damencho and saghul authored Jan 28, 2022
1 parent 332feef commit 43ab8e3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function _mapStateToProps(state) {
progress,
thenableWithCancel
} = state['features/authentication'];
const { authRequired } = state['features/base/conference'];
const { authRequired, conference } = state['features/base/conference'];
const { hosts: configHosts } = state['features/base/config'];
const {
connecting,
Expand All @@ -346,7 +346,7 @@ function _mapStateToProps(state) {

return {
..._abstractMapStateToProps(state),
_conference: authRequired,
_conference: authRequired || conference,
_configHosts: configHosts,
_connecting: Boolean(connecting) || Boolean(thenableWithCancel),
_error: connectionError || authenticateAndUpgradeRoleError,
Expand Down
4 changes: 2 additions & 2 deletions react/features/authentication/components/web/LoginDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,15 @@ function mapStateToProps(state) {
progress,
thenableWithCancel
} = state['features/authentication'];
const { authRequired } = state['features/base/conference'];
const { authRequired, conference } = state['features/base/conference'];
const { hosts: configHosts } = state['features/base/config'];
const {
connecting,
error: connectionError
} = state['features/base/connection'];

return {
_conference: authRequired,
_conference: authRequired || conference,
_configHosts: configHosts,
_connecting: connecting || thenableWithCancel,
_error: connectionError || authenticateAndUpgradeRoleError,
Expand Down
21 changes: 18 additions & 3 deletions react/features/authentication/middleware.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { MiddlewareRegistry } from '../base/redux';
import {
CANCEL_LOGIN,
STOP_WAIT_FOR_OWNER,
UPGRADE_ROLE_FINISHED,
WAIT_FOR_OWNER
} from './actionTypes';
import {
Expand Down Expand Up @@ -61,10 +62,15 @@ MiddlewareRegistry.register(store => next => action => {
// Go back to the app's entry point.
_hideLoginDialog(store);

// FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify
// the external-api.
const { authRequired, conference } = getState()['features/base/conference'];

dispatch(appNavigate(undefined));
// Only end the meeting if we are not already inside and trying to upgrade.
if (authRequired && !conference) {
// FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify
// the external-api.

dispatch(appNavigate(undefined));
}
}
break;
}
Expand Down Expand Up @@ -123,6 +129,15 @@ MiddlewareRegistry.register(store => next => action => {
store.dispatch(hideDialog(WaitForOwnerDialog));
break;

case UPGRADE_ROLE_FINISHED: {
const { error, progress } = action;

if (!error && progress === 1) {
_hideLoginDialog(store);
}
break;
}

case WAIT_FOR_OWNER: {
_clearExistingWaitForOwnerTimeout(store);

Expand Down
23 changes: 20 additions & 3 deletions react/features/authentication/middleware.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { MiddlewareRegistry } from '../base/redux';
import {
CANCEL_LOGIN,
STOP_WAIT_FOR_OWNER,
UPGRADE_ROLE_FINISHED,
WAIT_FOR_OWNER
} from './actionTypes';
import {
Expand All @@ -39,16 +40,23 @@ MiddlewareRegistry.register(store => next => action => {
switch (action.type) {

case CANCEL_LOGIN: {
const { dispatch, getState } = store;

if (!isDialogOpen(store, WaitForOwnerDialog)) {
if (_isWaitingForOwner(store)) {
store.dispatch(openWaitForOwnerDialog());
dispatch(openWaitForOwnerDialog());

return next(action);
}

store.dispatch(hideLoginDialog());
dispatch(hideLoginDialog());

const { authRequired, conference } = getState()['features/base/conference'];

store.dispatch(maybeRedirectToWelcomePage());
// Only end the meeting if we are not already inside and trying to upgrade.
if (authRequired && !conference) {
dispatch(maybeRedirectToWelcomePage());
}
}
break;
}
Expand Down Expand Up @@ -91,6 +99,15 @@ MiddlewareRegistry.register(store => next => action => {
store.dispatch(hideDialog(WaitForOwnerDialog));
break;

case UPGRADE_ROLE_FINISHED: {
const { error, progress } = action;

if (!error && progress === 1) {
store.dispatch(hideLoginDialog());
}
break;
}

case WAIT_FOR_OWNER: {
_clearExistingWaitForOwnerTimeout(store);

Expand Down

0 comments on commit 43ab8e3

Please sign in to comment.