feat(auth): add UPGRADE_ROLE_LOGIN_OK action
This commit is contained in:
parent
66da77bcf5
commit
9ae26a087e
|
@ -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.
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue