浏览代码

feat(auth): add UPGRADE_ROLE_LOGIN_OK action

master
paweldomas 8 年前
父节点
当前提交
9ae26a087e

+ 11
- 0
react/features/authentication/actionTypes.js 查看文件

@@ -43,6 +43,17 @@ export const STOP_WAIT_FOR_OWNER = Symbol('STOP_WAIT_FOR_OWNER');
43 43
  */
44 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 58
  * The type of (redux) action which signals that the process of authenticating
48 59
  * and upgrading the local participant's role has been started.

+ 6
- 1
react/features/authentication/actions.js 查看文件

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

+ 17
- 4
react/features/authentication/components/LoginDialog.native.js 查看文件

@@ -66,6 +66,13 @@ class LoginDialog extends Component {
66 66
          */
67 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 77
          * Redux store dispatch method.
71 78
          */
@@ -108,13 +115,16 @@ class LoginDialog extends Component {
108 115
         const {
109 116
             _connecting: connecting,
110 117
             _error: error,
118
+            _upgradeRoleLoginOk: upgradeRoleLoginOk,
111 119
             t
112 120
         } = this.props;
113 121
 
114 122
         let messageKey;
115 123
         let messageOptions;
116 124
 
117
-        if (error) {
125
+        if (upgradeRoleLoginOk) {
126
+            messageKey = 'connection.FETCH_SESSION_ID';
127
+        } else if (error) {
118 128
             const { name } = error;
119 129
 
120 130
             if (name === JitsiConnectionErrors.PASSWORD_REQUIRED) {
@@ -243,13 +253,15 @@ class LoginDialog extends Component {
243 253
  *     _conference: JitsiConference,
244 254
  *     _configHosts: Object,
245 255
  *     _connecting: boolean,
246
- *     _error: Object
256
+ *     _error: Object,
257
+ *     _upgradeRoleLoginOk: boolean
247 258
  * }}
248 259
  */
249 260
 function _mapStateToProps(state) {
250 261
     const {
251 262
         upgradeRoleError,
252
-        upgradeRoleInProgress
263
+        upgradeRoleInProgress,
264
+        upgradeRoleLoginOk
253 265
     } = state['features/authentication'];
254 266
     const { authRequired } = state['features/base/conference'];
255 267
     const { hosts: configHosts } = state['features/base/config'];
@@ -262,7 +274,8 @@ function _mapStateToProps(state) {
262 274
         _conference: authRequired,
263 275
         _configHosts: configHosts,
264 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 查看文件

@@ -6,6 +6,7 @@ import {
6 6
     CANCEL_LOGIN,
7 7
     STOP_WAIT_FOR_OWNER,
8 8
     UPGRADE_ROLE_FINISHED,
9
+    UPGRADE_ROLE_LOGIN_OK,
9 10
     UPGRADE_ROLE_STARTED,
10 11
     WAIT_FOR_OWNER
11 12
 } from './actionTypes';
@@ -15,7 +16,8 @@ ReducerRegistry.register('features/authentication', (state = {}, action) => {
15 16
     case CANCEL_LOGIN:
16 17
         return assign(state, {
17 18
             upgradeRoleError: undefined,
18
-            upgradeRoleInProgress: undefined
19
+            upgradeRoleInProgress: undefined,
20
+            upgradeRoleLoginOk: false
19 21
         });
20 22
 
21 23
     case STOP_WAIT_FOR_OWNER:
@@ -28,7 +30,13 @@ ReducerRegistry.register('features/authentication', (state = {}, action) => {
28 30
     case UPGRADE_ROLE_STARTED:
29 31
         return assign(state, {
30 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 42
     case WAIT_FOR_OWNER:

正在加载...
取消
保存