Skip to content

Commit

Permalink
fix: added error event for webinr authenticaiton
Browse files Browse the repository at this point in the history
  • Loading branch information
TCHDORUK committed Jun 7, 2024
1 parent 200b9b1 commit 915f38a
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 3 deletions.
3 changes: 3 additions & 0 deletions JitsiConferenceErrors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as exported from "./JitsiConferenceErrors";

describe( "/JitsiConferenceErrors members", () => {
const {
WEBINAR_AUTHENTICATION_REQUIRED,
AUTHENTICATION_REQUIRED,
CHAT_ERROR,
SETTINGS_ERROR,
Expand Down Expand Up @@ -31,6 +32,7 @@ describe( "/JitsiConferenceErrors members", () => {
} = exported;

it( "known members", () => {
expect( WEBINAR_AUTHENTICATION_REQUIRED ).toBe( 'conference.webinarAuthenticationRequired' );
expect( AUTHENTICATION_REQUIRED ).toBe( 'conference.authenticationRequired' );
expect( CHAT_ERROR ).toBe( 'conference.chatError' );
expect( SETTINGS_ERROR ).toBe( 'conference.settingsError' );
Expand All @@ -56,6 +58,7 @@ describe( "/JitsiConferenceErrors members", () => {

expect( JitsiConferenceErrors ).toBeDefined();

expect( JitsiConferenceErrors.WEBINAR_AUTHENTICATION_REQUIRED ).toBe( 'conference.webinarAuthenticationRequired' );
expect( JitsiConferenceErrors.AUTHENTICATION_REQUIRED ).toBe( 'conference.authenticationRequired' );
expect( JitsiConferenceErrors.CHAT_ERROR ).toBe( 'conference.chatError' );
expect( JitsiConferenceErrors.SETTINGS_ERROR ).toBe( 'conference.settingsError' );
Expand Down
6 changes: 6 additions & 0 deletions JitsiConferenceErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
*/

export enum JitsiConferenceErrors {
/**
* Indicates that client must be authenticated to create the conference.
*/
WEBINAR_AUTHENTICATION_REQUIRED = 'conference.webinarAuthenticationRequired',

/**
* Indicates that client must be authenticated to create the conference.
*/
Expand Down Expand Up @@ -122,6 +127,7 @@ export enum JitsiConferenceErrors {
};

// exported for backward compatibility
export const WEBINAR_AUTHENTICATION_REQUIRED = JitsiConferenceErrors.WEBINAR_AUTHENTICATION_REQUIRED;
export const AUTHENTICATION_REQUIRED = JitsiConferenceErrors.AUTHENTICATION_REQUIRED;
export const CHAT_ERROR = JitsiConferenceErrors.CHAT_ERROR;
export const SETTINGS_ERROR = JitsiConferenceErrors.SETTINGS_ERROR;
Expand Down
4 changes: 4 additions & 0 deletions JitsiConferenceEventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.PASSWORD_REQUIRED);

this.chatRoomForwarder.forward(XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.WEBINAR_AUTHENTICATION_REQUIRED);

this.chatRoomForwarder.forward(XMPPEvents.AUTHENTICATION_REQUIRED,
JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.AUTHENTICATION_REQUIRED);
Expand Down
9 changes: 8 additions & 1 deletion JitsiConnectionErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,18 @@ export enum JitsiConnectionErrors {
* Indicates that the connection was dropped, because of too many 5xx HTTP
* errors on BOSH requests.
*/
SERVER_ERROR = 'connection.serverError'
SERVER_ERROR = 'connection.serverError',

/**
* Indicates that the connection was dropped, because of too many 5xx HTTP
* errors on BOSH requests.
*/
WEBINAR_AUTHENTICATION_REQUIRED = 'connection.webinarAuthenticationRequired'
};

// exported for backward compatibility
export const CONNECTION_DROPPED_ERROR = JitsiConnectionErrors.CONNECTION_DROPPED_ERROR;
export const OTHER_ERROR = JitsiConnectionErrors.OTHER_ERROR;
export const PASSWORD_REQUIRED = JitsiConnectionErrors.PASSWORD_REQUIRED;
export const WEBINAR_AUTHENTICATION_REQUIRED = JitsiConnectionErrors.WEBINAR_AUTHENTICATION_REQUIRED;
export const SERVER_ERROR = JitsiConnectionErrors.SERVER_ERROR;
4 changes: 2 additions & 2 deletions modules/xmpp/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1384,12 +1384,12 @@ export default class ChatRoom extends Listenable {
}

if (isLdapForce.length || isLdapError.length) {
this.eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, {
this.eventEmitter.emit(XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED, {
type: 'ldap-auth-required',
errmsg: msg
});
} else {
this.eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, { type: 'email-required' });
this.eventEmitter.emit(XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED, { type: 'email-required' });
}
} else {
const msgNode = $(pres).find('>error[type="cancel"]>text');
Expand Down
1 change: 1 addition & 0 deletions service/xmpp/XMPPEvents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe( "/service/xmpp/XMPPEvents members", () => {
expect( XMPPEvents.ADD_ICE_CANDIDATE_FAILED ).toBe( 'xmpp.add_ice_candidate_failed' );
expect( XMPPEvents.AUDIO_MUTED_BY_FOCUS ).toBe( 'xmpp.audio_muted_by_focus' );
expect( XMPPEvents.VIDEO_MUTED_BY_FOCUS ).toBe( 'xmpp.video_muted_by_focus' );
expect( XMPPEvents.WEBINAR_AUTHENTICATION_REQUIRED ).toBe( 'xmpp.webinar_authentication_required' );
expect( XMPPEvents.AUTHENTICATION_REQUIRED ).toBe( 'xmpp.authentication_required' );
expect( XMPPEvents.BRIDGE_DOWN ).toBe( 'xmpp.bridge_down' );
expect( XMPPEvents.CALL_ACCEPTED ).toBe( 'xmpp.callaccepted.jingle' );
Expand Down
1 change: 1 addition & 0 deletions service/xmpp/XMPPEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum XMPPEvents {
// camera.
VIDEO_MUTED_BY_FOCUS = 'xmpp.video_muted_by_focus',
AUTHENTICATION_REQUIRED = 'xmpp.authentication_required',
WEBINAR_AUTHENTICATION_REQUIRED = 'xmpp.webinar_authentication_required',
BRIDGE_DOWN = 'xmpp.bridge_down',

/**
Expand Down
1 change: 1 addition & 0 deletions types/hand-crafted/JitsiConferenceErrors.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum JitsiConferenceErrors {
WEBINAR_AUTHENTICATION_REQUIRED = 'conference.webinarAuthenticationRequired',
AUTHENTICATION_REQUIRED = 'conference.authenticationRequired',
CHAT_ERROR = 'conference.chatError',
CONFERENCE_DESTROYED = 'conference.destroyed',
Expand Down
1 change: 1 addition & 0 deletions types/hand-crafted/service/xmpp/XMPPEvents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ADD_ICE_CANDIDATE_FAILED = 'xmpp.add_ice_candidate_failed',
AUDIO_MUTED_BY_FOCUS = 'xmpp.audio_muted_by_focus',
VIDEO_MUTED_BY_FOCUS = 'xmpp.video_muted_by_focus',
WEBINAR_AUTHENTICATION_REQUIRED = 'xmpp.webinar_authentication_required',
AUTHENTICATION_REQUIRED = 'xmpp.authentication_required',
BRIDGE_DOWN = 'xmpp.bridge_down',
CALL_ACCEPTED = 'xmpp.callaccepted.jingle',
Expand Down

0 comments on commit 915f38a

Please sign in to comment.