Skip to content

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

feat(auth): add UPGRADE_ROLE_LOGIN_OK action

paweldomas9ae26a087e8c
diff --git a/react/features/authentication/actionTypes.js b/react/features/authentication/actionTypes.js
index 2d2aa9f182..501248971a 100644
--- a/react/features/authentication/actionTypes.js
+++ b/react/features/authentication/actionTypes.js
@@ -43,6 +43,17 @@ export const STOP_WAIT_FOR_OWNER = Symbol('STOP_WAIT_FOR_OWNER');
*/
export const UPGRADE_ROLE_FINISHED = Symbol('UPGRADE_ROLE_FINISHED');
+/**
+ * The type of (redux) action which informs that the authentication and role
+ * upgrade process has finished the XMPP authentication part of the process
+ * (which means that the XMPP credentials are OK).
+ *
+ * {
+ * type: UPGRADE_ROLE_LOGIN_ON
+ * }
+ */
+export const UPGRADE_ROLE_LOGIN_OK = Symbol('UPGRADE_ROLE_LOGIN_OK');
+
/**
* The type of (redux) action which signals that the process of authenticating
* and upgrading the local participant's role has been started.
diff --git a/react/features/authentication/actions.js b/react/features/authentication/actions.js
index c7320b55b6..25eba9d1cf 100644
--- a/react/features/authentication/actions.js
+++ b/react/features/authentication/actions.js
@@ -8,6 +8,7 @@ import {
CANCEL_WAIT_FOR_OWNER,
STOP_WAIT_FOR_OWNER,
UPGRADE_ROLE_FINISHED,
+ UPGRADE_ROLE_LOGIN_OK,
UPGRADE_ROLE_STARTED,
WAIT_FOR_OWNER
} from './actionTypes';
@@ -38,7 +39,11 @@ export function authenticateAndUpgradeRole(
= conference.authenticateAndUpgradeRole({
id,
password,
- roomPassword
+ roomPassword,
+
+ onLoginSuccessful() {
+ return dispatch({ type: UPGRADE_ROLE_LOGIN_OK });
+ }
});
dispatch(_upgradeRoleStarted(process));
diff --git a/react/features/authentication/components/LoginDialog.native.js b/react/features/authentication/components/LoginDialog.native.js
index cb25a01566..747d49b1da 100644
--- a/react/features/authentication/components/LoginDialog.native.js
+++ b/react/features/authentication/components/LoginDialog.native.js
@@ -66,6 +66,13 @@ class LoginDialog extends Component {
*/
_error: PropTypes.object,
+ /**
+ * Flag indicates that during the "upgrade role and authenticate"
+ * process the login part was successful and the next step is to obtain
+ * a session ID from Jicofo.
+ */
+ _upgradeRoleLoginOk: PropTypes.bool,
+
/**
* Redux store dispatch method.
*/
@@ -108,13 +115,16 @@ class LoginDialog extends Component {
const {
_connecting: connecting,
_error: error,
+ _upgradeRoleLoginOk: upgradeRoleLoginOk,
t
} = this.props;
let messageKey;
let messageOptions;
- if (error) {
+ if (upgradeRoleLoginOk) {
+ messageKey = 'connection.FETCH_SESSION_ID';
+ } else if (error) {
const { name } = error;
if (name === JitsiConnectionErrors.PASSWORD_REQUIRED) {
@@ -243,13 +253,15 @@ class LoginDialog extends Component {
* _conference: JitsiConference,
* _configHosts: Object,
* _connecting: boolean,
- * _error: Object
+ * _error: Object,
+ * _upgradeRoleLoginOk: boolean
* }}
*/
function _mapStateToProps(state) {
const {
upgradeRoleError,
- upgradeRoleInProgress
+ upgradeRoleInProgress,
+ upgradeRoleLoginOk
} = state['features/authentication'];
const { authRequired } = state['features/base/conference'];
const { hosts: configHosts } = state['features/base/config'];
@@ -262,7 +274,8 @@ function _mapStateToProps(state) {
_conference: authRequired,
_configHosts: configHosts,
_connecting: Boolean(connecting) || Boolean(upgradeRoleInProgress),
- _error: connectionError || upgradeRoleError
+ _error: connectionError || upgradeRoleError,
+ _upgradeRoleLoginOk: upgradeRoleLoginOk
};
}
diff --git a/react/features/authentication/reducer.js b/react/features/authentication/reducer.js
index 573f0cbe3a..9b9c87f2b1 100644
--- a/react/features/authentication/reducer.js
+++ b/react/features/authentication/reducer.js
@@ -6,6 +6,7 @@ import {
CANCEL_LOGIN,
STOP_WAIT_FOR_OWNER,
UPGRADE_ROLE_FINISHED,
+ UPGRADE_ROLE_LOGIN_OK,
UPGRADE_ROLE_STARTED,
WAIT_FOR_OWNER
} from './actionTypes';
@@ -15,7 +16,8 @@ ReducerRegistry.register('features/authentication', (state = {}, action) => {
case CANCEL_LOGIN:
return assign(state, {
upgradeRoleError: undefined,
- upgradeRoleInProgress: undefined
+ upgradeRoleInProgress: undefined,
+ upgradeRoleLoginOk: false
});
case STOP_WAIT_FOR_OWNER:
@@ -28,7 +30,13 @@ ReducerRegistry.register('features/authentication', (state = {}, action) => {
case UPGRADE_ROLE_STARTED:
return assign(state, {
upgradeRoleError: action.error,
- upgradeRoleInProgress: action.thenableWithCancel
+ upgradeRoleInProgress: action.thenableWithCancel,
+ upgradeRoleLoginOk: false
+ });
+
+ case UPGRADE_ROLE_LOGIN_OK:
+ return assign(state, {
+ upgradeRoleLoginOk: true
});
case WAIT_FOR_OWNER: