Quellcode durchsuchen

fix(authentication): Fixes web login dialog to connect and join.

factor2
damencho vor 2 Jahren
Ursprung
Commit
c58e557019

+ 4
- 2
react/features/authentication/components/web/LoginDialog.tsx Datei anzeigen

@@ -5,12 +5,12 @@ import { connect as reduxConnect } from 'react-redux';
5 5
 import { IReduxState, IStore } from '../../../app/types';
6 6
 import { IJitsiConference } from '../../../base/conference/reducer';
7 7
 import { IConfig } from '../../../base/config/configType';
8
-import { connect } from '../../../base/connection/actions.web';
9 8
 import { toJid } from '../../../base/connection/functions';
10 9
 import { translate, translateToHTML } from '../../../base/i18n/functions';
11 10
 import { JitsiConnectionErrors } from '../../../base/lib-jitsi-meet';
12 11
 import Dialog from '../../../base/ui/components/web/Dialog';
13 12
 import Input from '../../../base/ui/components/web/Input';
13
+import { joinConference } from '../../../prejoin/actions.web';
14 14
 import {
15 15
     authenticateAndUpgradeRole,
16 16
     cancelLogin
@@ -134,7 +134,9 @@ class LoginDialog extends Component<IProps, IState> {
134 134
         if (conference) {
135 135
             dispatch(authenticateAndUpgradeRole(jid, password, conference));
136 136
         } else {
137
-            dispatch(connect(jid, password));
137
+            // dispatch(connect(jid, password));
138
+            // FIXME: Workaround for the web version. To be removed once we get rid of conference.js
139
+            dispatch(joinConference(undefined, false, jid, password));
138 140
         }
139 141
     }
140 142
 

+ 12
- 8
react/features/base/conference/middleware.any.ts Datei anzeigen

@@ -24,7 +24,7 @@ import { overwriteConfig } from '../config/actions';
24 24
 import { CONNECTION_ESTABLISHED, CONNECTION_FAILED } from '../connection/actionTypes';
25 25
 import { connect, connectionDisconnected, disconnect } from '../connection/actions';
26 26
 import { validateJwt } from '../jwt/functions';
27
-import { JitsiConferenceErrors } from '../lib-jitsi-meet';
27
+import { JitsiConferenceErrors, JitsiConnectionErrors } from '../lib-jitsi-meet';
28 28
 import { PARTICIPANT_UPDATED, PIN_PARTICIPANT } from '../participants/actionTypes';
29 29
 import { PARTICIPANT_ROLE } from '../participants/constants';
30 30
 import {
@@ -392,18 +392,22 @@ function _logJwtErrors(message: string, state: IReduxState) {
392 392
 function _connectionFailed({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
393 393
     _logJwtErrors(action.error.message, getState());
394 394
 
395
-    dispatch(showErrorNotification({
396
-        descriptionKey: 'dialog.tokenAuthFailed',
397
-        titleKey: 'dialog.tokenAuthFailedTitle'
398
-    }, NOTIFICATION_TIMEOUT_TYPE.LONG));
395
+    const { connection, error } = action;
396
+
397
+    // do not show the notification when we will prompt the user
398
+    // for username and password
399
+    if (error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
400
+        && getState()['features/base/jwt'].jwt) {
401
+        dispatch(showErrorNotification({
402
+            descriptionKey: 'dialog.tokenAuthFailed',
403
+            titleKey: 'dialog.tokenAuthFailedTitle'
404
+        }, NOTIFICATION_TIMEOUT_TYPE.LONG));
405
+    }
399 406
 
400 407
     const result = next(action);
401 408
 
402 409
     _removeUnloadHandler(getState);
403 410
 
404
-    const { connection } = action;
405
-    const { error } = action;
406
-
407 411
     forEachConference(getState, conference => {
408 412
         // TODO: revisit this
409 413
         // It feels that it would make things easier if JitsiConference

+ 5
- 2
react/features/prejoin/actions.web.ts Datei anzeigen

@@ -211,9 +211,12 @@ export function initPrejoin(tracks: Object[], errors: Object) {
211 211
  *
212 212
  * @param {Object} options - The config options that override the default ones (if any).
213 213
  * @param {boolean} ignoreJoiningInProgress - If true we won't check the joiningInProgress flag.
214
+ * @param {string?} jid - The XMPP user's ID (e.g. {@code user@server.com}).
215
+ * @param {string?} password - The XMPP user's password.
214 216
  * @returns {Function}
215 217
  */
216
-export function joinConference(options?: Object, ignoreJoiningInProgress = false) {
218
+export function joinConference(options?: Object, ignoreJoiningInProgress = false,
219
+        jid?: string, password?: string) {
217 220
     return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) {
218 221
         if (!ignoreJoiningInProgress) {
219 222
             const state = getState();
@@ -228,7 +231,7 @@ export function joinConference(options?: Object, ignoreJoiningInProgress = false
228 231
 
229 232
         options && dispatch(updateConfig(options));
230 233
 
231
-        dispatch(connect()).then(async () => {
234
+        dispatch(connect(jid, password)).then(async () => {
232 235
             // TODO keep this here till we move tracks and conference management from
233 236
             // conference.js to react.
234 237
             const state = getState();

Laden…
Abbrechen
Speichern