on-the-fly auth improvements
This commit is contained in:
parent
a10f9437f1
commit
3400925f99
|
@ -332,7 +332,7 @@ JitsiConference.prototype.lock = function (password) {
|
|||
|
||||
var conference = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
conference.xmpp.lockRoom(password, function () {
|
||||
conference.room.lockRoom(password || "", function () {
|
||||
resolve();
|
||||
}, function (err) {
|
||||
reject(err);
|
||||
|
@ -347,7 +347,7 @@ JitsiConference.prototype.lock = function (password) {
|
|||
* @returns {Promise}
|
||||
*/
|
||||
JitsiConference.prototype.unlock = function () {
|
||||
return this.lock(undefined);
|
||||
return this.lock();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -10482,8 +10482,7 @@ module.exports = TraceablePeerConnection;
|
|||
}).call(this,"/modules/xmpp/TraceablePeerConnection.js")
|
||||
},{"../../service/xmpp/XMPPEvents":87,"../RTC/RTC":16,"../RTC/RTCBrowserType.js":17,"./LocalSSRCReplacement":29,"jitsi-meet-logger":48,"sdp-interop":66,"sdp-simulcast":69,"sdp-transform":76}],34:[function(require,module,exports){
|
||||
(function (__filename){
|
||||
/* global $, $iq, APP, config, messageHandler,
|
||||
roomName, sessionTerminated, Strophe, Util */
|
||||
/* global $, $iq, Promise, Strophe */
|
||||
|
||||
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||
var XMPPEvents = require("../../service/xmpp/XMPPEvents");
|
||||
|
@ -10838,6 +10837,22 @@ Moderator.prototype.allocateConferenceFocus = function (callback) {
|
|||
);
|
||||
};
|
||||
|
||||
Moderator.prototype.authenticate = function () {
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
self.connection.sendIQ(
|
||||
self.createConferenceIq(),
|
||||
function (result) {
|
||||
self.parseSessionId(result);
|
||||
resolve();
|
||||
}, function (error) {
|
||||
var code = $(error).find('>error').attr('code');
|
||||
reject(error, code);
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
Moderator.prototype.getLoginUrl = function (urlCallback, failureCallback) {
|
||||
var iq = $iq({to: this.getFocusComponent(), type: 'get'});
|
||||
iq.c('login-url', {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global JitsiMeetJS */
|
||||
/* global JitsiMeetJS, APP */
|
||||
|
||||
import LoginDialog from './UI/authentication/LoginDialog';
|
||||
import UIEvents from '../service/UI/UIEvents';
|
||||
|
@ -44,14 +44,16 @@ function doXmppAuth (room, lockPassword) {
|
|||
// open room
|
||||
let newRoom = connection.initJitsiConference(room.getName());
|
||||
|
||||
newRoom.on(ConferenceEvents.CONFERENCE_FAILED, function (err) {
|
||||
connection.disconnect();
|
||||
loginDialog.displayError(err);
|
||||
});
|
||||
loginDialog.displayConnectionStatus(
|
||||
APP.translation.translateString('connection.FETCH_SESSION_ID')
|
||||
);
|
||||
|
||||
newRoom.room.moderator.allocateConferenceFocus(function () {
|
||||
newRoom.room.moderator.authenticate().then(function () {
|
||||
connection.disconnect();
|
||||
loginDialog.close();
|
||||
|
||||
loginDialog.displayConnectionStatus(
|
||||
APP.translation.translateString('connection.GOT_SESSION_ID')
|
||||
);
|
||||
|
||||
if (room.isJoined()) {
|
||||
// just reallocate focus if already joined
|
||||
|
@ -60,8 +62,19 @@ function doXmppAuth (room, lockPassword) {
|
|||
// or join
|
||||
room.join(lockPassword);
|
||||
}
|
||||
});
|
||||
|
||||
loginDialog.close();
|
||||
}).catch(function (error, code) {
|
||||
connection.disconnect();
|
||||
|
||||
console.error('Auth on the fly failed', error);
|
||||
|
||||
let errorMsg = APP.translation.translateString(
|
||||
'connection.GET_SESSION_ID_ERROR'
|
||||
);
|
||||
|
||||
loginDialog.displayError(errorMsg + code);
|
||||
});
|
||||
}, function (err) {
|
||||
loginDialog.displayError(err);
|
||||
});
|
||||
|
|
|
@ -92,6 +92,7 @@ export default function createRoomLocker (room) {
|
|||
return room.lock(newPass).then(function () {
|
||||
password = newPass;
|
||||
}).catch(function (err) {
|
||||
console.error(err);
|
||||
if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
|
||||
notifyPasswordNotSupported();
|
||||
} else {
|
||||
|
@ -111,7 +112,7 @@ export default function createRoomLocker (room) {
|
|||
},
|
||||
|
||||
askToUnlock () {
|
||||
askToUnlock().then(function () {
|
||||
return askToUnlock().then(function () {
|
||||
return lock();
|
||||
}).then(function () {
|
||||
AnalyticsAdapter.sendEvent('toolbar.lock.disabled');
|
||||
|
|
|
@ -110,14 +110,21 @@ function Dialog(successCallback, cancelCallback) {
|
|||
*/
|
||||
this.displayError = function (message) {
|
||||
|
||||
var finishedState = connDialog.getState('finished');
|
||||
let finishedState = connDialog.getState('finished');
|
||||
|
||||
var errorMessageElem = finishedState.find('#errorMessage');
|
||||
let errorMessageElem = finishedState.find('#errorMessage');
|
||||
errorMessageElem.text(message);
|
||||
|
||||
connDialog.goToState('finished');
|
||||
};
|
||||
|
||||
this.displayConnectionStatus = function (message) {
|
||||
let connectingState = connDialog.getState('connecting');
|
||||
|
||||
let connectionStatus = connectingState.find('#connectionStatus');
|
||||
connectionStatus.text(message);
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes LoginDialog.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue