Explorar el Código

feat(auth): add UPGRADE_ROLE_LOGIN_OK action

master
paweldomas hace 8 años
padre
commit
9ae26a087e

+ 11
- 0
react/features/authentication/actionTypes.js Ver fichero

43
  */
43
  */
44
 export const UPGRADE_ROLE_FINISHED = Symbol('UPGRADE_ROLE_FINISHED');
44
 export const UPGRADE_ROLE_FINISHED = Symbol('UPGRADE_ROLE_FINISHED');
45
 
45
 
46
+/**
47
+ * The type of (redux) action which informs that the authentication and role
48
+ * upgrade process has finished the XMPP authentication part of the process
49
+ * (which means that the XMPP credentials are OK).
50
+ *
51
+ * {
52
+ *     type: UPGRADE_ROLE_LOGIN_ON
53
+ * }
54
+ */
55
+export const UPGRADE_ROLE_LOGIN_OK = Symbol('UPGRADE_ROLE_LOGIN_OK');
56
+
46
 /**
57
 /**
47
  * The type of (redux) action which signals that the process of authenticating
58
  * The type of (redux) action which signals that the process of authenticating
48
  * and upgrading the local participant's role has been started.
59
  * and upgrading the local participant's role has been started.

+ 6
- 1
react/features/authentication/actions.js Ver fichero

8
     CANCEL_WAIT_FOR_OWNER,
8
     CANCEL_WAIT_FOR_OWNER,
9
     STOP_WAIT_FOR_OWNER,
9
     STOP_WAIT_FOR_OWNER,
10
     UPGRADE_ROLE_FINISHED,
10
     UPGRADE_ROLE_FINISHED,
11
+    UPGRADE_ROLE_LOGIN_OK,
11
     UPGRADE_ROLE_STARTED,
12
     UPGRADE_ROLE_STARTED,
12
     WAIT_FOR_OWNER
13
     WAIT_FOR_OWNER
13
 } from './actionTypes';
14
 } from './actionTypes';
38
             = conference.authenticateAndUpgradeRole({
39
             = conference.authenticateAndUpgradeRole({
39
                 id,
40
                 id,
40
                 password,
41
                 password,
41
-                roomPassword
42
+                roomPassword,
43
+
44
+                onLoginSuccessful() {
45
+                    return dispatch({ type: UPGRADE_ROLE_LOGIN_OK });
46
+                }
42
             });
47
             });
43
 
48
 
44
         dispatch(_upgradeRoleStarted(process));
49
         dispatch(_upgradeRoleStarted(process));

+ 17
- 4
react/features/authentication/components/LoginDialog.native.js Ver fichero

66
          */
66
          */
67
         _error: PropTypes.object,
67
         _error: PropTypes.object,
68
 
68
 
69
+        /**
70
+         * Flag indicates that during the "upgrade role and authenticate"
71
+         * process the login part was successful and the next step is to obtain
72
+         * a session ID from Jicofo.
73
+         */
74
+        _upgradeRoleLoginOk: PropTypes.bool,
75
+
69
         /**
76
         /**
70
          * Redux store dispatch method.
77
          * Redux store dispatch method.
71
          */
78
          */
108
         const {
115
         const {
109
             _connecting: connecting,
116
             _connecting: connecting,
110
             _error: error,
117
             _error: error,
118
+            _upgradeRoleLoginOk: upgradeRoleLoginOk,
111
             t
119
             t
112
         } = this.props;
120
         } = this.props;
113
 
121
 
114
         let messageKey;
122
         let messageKey;
115
         let messageOptions;
123
         let messageOptions;
116
 
124
 
117
-        if (error) {
125
+        if (upgradeRoleLoginOk) {
126
+            messageKey = 'connection.FETCH_SESSION_ID';
127
+        } else if (error) {
118
             const { name } = error;
128
             const { name } = error;
119
 
129
 
120
             if (name === JitsiConnectionErrors.PASSWORD_REQUIRED) {
130
             if (name === JitsiConnectionErrors.PASSWORD_REQUIRED) {
243
  *     _conference: JitsiConference,
253
  *     _conference: JitsiConference,
244
  *     _configHosts: Object,
254
  *     _configHosts: Object,
245
  *     _connecting: boolean,
255
  *     _connecting: boolean,
246
- *     _error: Object
256
+ *     _error: Object,
257
+ *     _upgradeRoleLoginOk: boolean
247
  * }}
258
  * }}
248
  */
259
  */
249
 function _mapStateToProps(state) {
260
 function _mapStateToProps(state) {
250
     const {
261
     const {
251
         upgradeRoleError,
262
         upgradeRoleError,
252
-        upgradeRoleInProgress
263
+        upgradeRoleInProgress,
264
+        upgradeRoleLoginOk
253
     } = state['features/authentication'];
265
     } = state['features/authentication'];
254
     const { authRequired } = state['features/base/conference'];
266
     const { authRequired } = state['features/base/conference'];
255
     const { hosts: configHosts } = state['features/base/config'];
267
     const { hosts: configHosts } = state['features/base/config'];
262
         _conference: authRequired,
274
         _conference: authRequired,
263
         _configHosts: configHosts,
275
         _configHosts: configHosts,
264
         _connecting: Boolean(connecting) || Boolean(upgradeRoleInProgress),
276
         _connecting: Boolean(connecting) || Boolean(upgradeRoleInProgress),
265
-        _error: connectionError || upgradeRoleError
277
+        _error: connectionError || upgradeRoleError,
278
+        _upgradeRoleLoginOk: upgradeRoleLoginOk
266
     };
279
     };
267
 }
280
 }
268
 
281
 

+ 10
- 2
react/features/authentication/reducer.js Ver fichero

6
     CANCEL_LOGIN,
6
     CANCEL_LOGIN,
7
     STOP_WAIT_FOR_OWNER,
7
     STOP_WAIT_FOR_OWNER,
8
     UPGRADE_ROLE_FINISHED,
8
     UPGRADE_ROLE_FINISHED,
9
+    UPGRADE_ROLE_LOGIN_OK,
9
     UPGRADE_ROLE_STARTED,
10
     UPGRADE_ROLE_STARTED,
10
     WAIT_FOR_OWNER
11
     WAIT_FOR_OWNER
11
 } from './actionTypes';
12
 } from './actionTypes';
15
     case CANCEL_LOGIN:
16
     case CANCEL_LOGIN:
16
         return assign(state, {
17
         return assign(state, {
17
             upgradeRoleError: undefined,
18
             upgradeRoleError: undefined,
18
-            upgradeRoleInProgress: undefined
19
+            upgradeRoleInProgress: undefined,
20
+            upgradeRoleLoginOk: false
19
         });
21
         });
20
 
22
 
21
     case STOP_WAIT_FOR_OWNER:
23
     case STOP_WAIT_FOR_OWNER:
28
     case UPGRADE_ROLE_STARTED:
30
     case UPGRADE_ROLE_STARTED:
29
         return assign(state, {
31
         return assign(state, {
30
             upgradeRoleError: action.error,
32
             upgradeRoleError: action.error,
31
-            upgradeRoleInProgress: action.thenableWithCancel
33
+            upgradeRoleInProgress: action.thenableWithCancel,
34
+            upgradeRoleLoginOk: false
35
+        });
36
+
37
+    case UPGRADE_ROLE_LOGIN_OK:
38
+        return assign(state, {
39
+            upgradeRoleLoginOk: true
32
         });
40
         });
33
 
41
 
34
     case WAIT_FOR_OWNER:
42
     case WAIT_FOR_OWNER:

Loading…
Cancelar
Guardar