diff --git a/lang/main.json b/lang/main.json
index 21218c24d..1de3a98fe 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -132,6 +132,7 @@
"passwordError2": "This conversation isn't currently protected by a password. Only the owner of the conference could set a password.",
"joinError": "Oops! We couldn't join the conference. There might be some problem with security configuration. Please contact service administrator.",
"connectError": "Oops! Something went wrong and we couldn't connect to the conference.",
+ "connecting": "Connecting",
"error": "Error",
"detectext": "Error when trying to detect desktopsharing extension.",
"failtoinstall": "Failed to install desktop sharing extension",
@@ -159,6 +160,7 @@
"AuthMsg": "Authentication is required to create room: __room__ You can either authenticate to create the room or just wait for someone else to do so.",
"Authenticate": "Authenticate",
"Cancel": "Cancel",
+ "retry": "Retry",
"logoutTitle" : "Logout",
"logoutQuestion" : "Are you sure you want to logout and stop the conference?",
"sessTerminated": "Session Terminated",
@@ -216,5 +218,20 @@
"Talk to you in a sec!"
],
"and": "and"
+ },
+ "connection":
+ {
+ "ERROR": "Error",
+ "CONNECTING": "Connecting",
+ "CONNFAIL": "Connection failed",
+ "AUTHENTICATING": "Authenticating",
+ "AUTHFAIL": "Authentication failed",
+ "CONNECTED": "Connected",
+ "DISCONNECTED": "Disconnected",
+ "DISCONNECTING": "Disconnecting",
+ "ATTACHED": "Attached",
+ "FETCH_SESSION_ID": "Obtaining session-id...",
+ "GOT_SESSION_ID": "Obtaining session-id... Done",
+ "GET_SESSION_ID_ERROR": "Get session-id error: "
}
}
diff --git a/modules/UI/authentication/Authentication.js b/modules/UI/authentication/Authentication.js
index 8ff2b3d40..ec7770dba 100644
--- a/modules/UI/authentication/Authentication.js
+++ b/modules/UI/authentication/Authentication.js
@@ -1,4 +1,7 @@
-/* global $, APP */
+/* global $, APP*/
+
+var LoginDialog = require('./LoginDialog');
+var Moderator = require('../../xmpp/moderator');
/* Initial "authentication required" dialog */
var authDialog = null;
@@ -50,6 +53,37 @@ var Authentication = {
authenticationWindow = null;
}
},
+ xmppAuthenticate: function () {
+
+ var loginDialog = LoginDialog.show(
+ function (connection, state) {
+ if (!state) {
+ // User cancelled
+ loginDialog.close();
+ return;
+ } else if (state == APP.xmpp.Status.CONNECTED) {
+
+ loginDialog.close();
+
+ Authentication.stopInterval();
+ Authentication.closeAuthenticationDialog();
+
+ // Close the connection as anonymous one will be used
+ // to create the conference. Session-id will authorize
+ // the request.
+ connection.disconnect();
+
+ var roomName = APP.UI.generateRoomName();
+ Moderator.allocateConferenceFocus(roomName, function () {
+ // If it's not "on the fly" authentication now join
+ // the conference room
+ if (!APP.xmpp.getMUCJoined()) {
+ APP.UI.checkForNicknameAndJoin();
+ }
+ });
+ }
+ }, true);
+ },
focusAuthenticationWindow: function () {
// If auth window exists just bring it to the front
if (authenticationWindow) {
@@ -60,7 +94,7 @@ var Authentication = {
closeAuthenticationDialog: function () {
// Close authentication dialog if opened
if (authDialog) {
- APP.UI.messageHandler.closeDialog();
+ authDialog.close();
authDialog = null;
}
},
@@ -70,10 +104,7 @@ var Authentication = {
// On closed
function () {
// Close authentication dialog if opened
- if (authDialog) {
- messageHandler.closeDialog();
- authDialog = null;
- }
+ Authentication.closeAuthenticationDialog();
callback();
authenticationWindow = null;
});
diff --git a/modules/UI/authentication/LoginDialog.js b/modules/UI/authentication/LoginDialog.js
new file mode 100644
index 000000000..f2d7ce2f9
--- /dev/null
+++ b/modules/UI/authentication/LoginDialog.js
@@ -0,0 +1,228 @@
+/* global $, APP, config*/
+
+var XMPP = require('../../xmpp/xmpp');
+var Moderator = require('../../xmpp/moderator');
+
+//FIXME: use LoginDialog to add retries to XMPP.connect method used when
+// anonymous domain is not enabled
+
+/**
+ * Creates new Dialog instance.
+ * @param callback function(Strophe.Connection, Strophe.Status) called
+ * when we either fail to connect or succeed(check Strophe.Status).
+ * @param obtainSession true if we want to send ConferenceIQ to Jicofo
+ * in order to create session-id after the connection is established.
+ * @constructor
+ */
+function Dialog(callback, obtainSession) {
+
+ var self = this;
+
+ var stop = false;
+
+ var connection = APP.xmpp.createConnection();
+
+ var message = '