Adjusts anonymous domain functionality to work with Jicofo.

This commit is contained in:
paweldomas 2015-01-14 17:58:13 +01:00
parent ee94eca733
commit d3003d4fcd
2 changed files with 23 additions and 4 deletions

View File

@ -190,7 +190,17 @@ var Moderator = (function (my) {
// Not authorized to create new room // Not authorized to create new room
if ($(error).find('>error>not-authorized').length) { if ($(error).find('>error>not-authorized').length) {
console.warn("Unauthorized to start the conference"); console.warn("Unauthorized to start the conference");
var toDomain
= Strophe.getDomainFromJid(error.getAttribute('to'));
if (toDomain === config.hosts.anonymousdomain) {
// we are connected with anonymous domain and
// only non anonymous users can create rooms
// we must authorize the user
$(document).trigger('passwordrequired.main');
} else {
// External authentication mode
UI.onAuthenticationRequired(); UI.onAuthenticationRequired();
}
return; return;
} }
var waitMs = getNextErrorTimeout(); var waitMs = getNextErrorTimeout();

15
muc.js
View File

@ -255,9 +255,18 @@ Strophe.addConnectionPlugin('emuc', {
'>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) { '>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to')); var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
if(toDomain === config.hosts.anonymousdomain) { if(toDomain === config.hosts.anonymousdomain) {
// we are connected with anonymous domain and only non anonymous users can create rooms // We are connected with anonymous domain and only non anonymous
// we must authorize the user // users can create rooms, but focus should not allow us to
$(document).trigger('passwordrequired.main'); // enter the room by replying with 'not-authorized'. This would
// result in reconnection from authorized domain.
// We're either missing Jicofo/Prosody config for anonymous
// domains or something is wrong.
//$(document).trigger('passwordrequired.main');
UI.messageHandler.openReportDialog(null,
'Oops ! We couldn`t join the conference.' +
' There might be some problem with security' +
' configuration. Please contact service' +
' administrator.', pres);
} else { } else {
console.warn('onPresError ', pres); console.warn('onPresError ', pres);
UI.messageHandler.openReportDialog(null, UI.messageHandler.openReportDialog(null,