Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(meeting): fetching captcha details within meeting object #337

Merged
merged 6 commits into from
Jun 28, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion src/MeetingsSDKAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
remoteAudio: null,
remoteVideo: null,
remoteShare: null,
requiredCaptcha: {},
showRoster: null,
settings: {
visible: false,
Expand Down Expand Up @@ -634,7 +635,25 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
const sdkMeeting = this.fetchMeeting(ID);

if (sdkMeeting.passwordStatus === 'REQUIRED') {
await sdkMeeting.verifyPassword(options.hostKey || options.password);
const res = await sdkMeeting.verifyPassword(options.hostKey || options.password, options.captcha);

if (!res.isPasswordValid) {
this.updateMeeting(ID, () => (
{
failureReason: res.failureReason,
invalidPassword: true,
...(res.requiredCaptcha && {
requiredCaptcha: {
captchaId: res.requiredCaptcha.captchaId,
refreshURL: res.requiredCaptcha.refreshURL,
verificationAudioURL: res.requiredCaptcha.verificationAudioURL,
verificationImageURL: res.requiredCaptcha.verificationImageURL,
},
}),
}));
} else {
logger.info('MEETING', ID, 'joinMeeting()', 'Password successfully verified');
}
}
sdkMeeting.meetingFiniteStateMachine.reset();
logger.debug('MEETING', ID, 'joinMeeting()', ['calling sdkMeeting.join() with', {pin: options.password, moderator: false, name: options.name}]);
Expand Down Expand Up @@ -1406,4 +1425,22 @@ export default class MeetingsSDKAdapter extends MeetingsAdapter {
async clearInvalidHostKeyFlag(ID) {
await this.updateMeeting(ID, async () => ({invalidHostKey: false}));
}

/**
* Refreshes the captcha code.
*
* @async
* @param {string} ID Id of the meeting
*/
async refreshCaptcha(ID) {
sreenara marked this conversation as resolved.
Show resolved Hide resolved
logger.debug('MEETING', ID, 'refreshCaptcha()', ['called with', {ID}]);
const sdkMeeting = this.fetchMeeting(ID);

await sdkMeeting.refreshCaptcha();
this.updateMeeting(ID, () => (
{
requiredCaptcha: sdkMeeting.requiredCaptcha,
}
));
}
}