Commit df931af2 authored by JC Brand's avatar JC Brand

Re-implement the login dialog as part of the controlbox.

parent 9f437cbc
......@@ -159,7 +159,8 @@ input.new-chatroom-name {
}
div#settings,
div#chatrooms {
div#chatrooms,
div#login-dialog {
height: 279px;
}
......@@ -477,6 +478,10 @@ div#controlbox-panes {
width: 199px;
}
form#xmppchat-login {
padding: 2em 0 0.3em 0.5em;
}
form.set-xmpp-status,
form.add-chatroom {
padding: 0.5em 0 0.3em 0.5em;
......@@ -544,6 +549,7 @@ ul#controlbox-tabs a.current, ul#controlbox-tabs a.current:hover {
div#users,
div#chatrooms,
div#login-dialog,
div#settings {
border: 0;
font-size: 14px;
......
This diff is collapsed.
......@@ -9,16 +9,6 @@
</head>
<body>
<h1>Converse.js Demo Page</h1>
Log in with your Jabber/XMPP ID and password.
<!-- login dialog -->
<div id='login_dialog' class='hidden'>
<label>Login ID:</label>
<input type='text' id='jid'>
<label>Password:</label>
<input type='password' id='password'>
<label>BOSH Service URL:</label>
<input type='text' id='bosh_service_url'>
</div>
<div id="collective-xmpp-chat-data"></div>
</body>
</html>
require(["jquery", "converse"], function($) {
$(function() {
$('#login_dialog').dialog({
autoOpen: true,
draggable: false,
modal: true,
title: 'Connect to XMPP',
buttons: {
"Connect": function () {
$(document).trigger('connect', {
jid: $('#jid').val(),
password: $('#password').val(),
bosh_service_url: $('#bosh_service_url').val()
});
$('#password').val('');
$(this).dialog('close');
}
}
});
$(document).bind('connect', function (ev, data) {
var connection = new Strophe.Connection(data.bosh_service_url);
connection.connect(data.jid, data.password, function (status) {
if (status === Strophe.Status.CONNECTED) {
console.log('Connected');
$(document).trigger('jarnxmpp.connected', connection);
} else if (status === Strophe.Status.DISCONNECTED) {
console.log('Disconnected');
$(document).trigger('jarnxmpp.disconnected');
} else if (status === Strophe.Status.Error) {
console.log('Error');
} else if (status === Strophe.Status.CONNECTING) {
console.log('Connecting');
} else if (status === Strophe.Status.CONNFAIL) {
console.log('Connection Failed');
} else if (status === Strophe.Status.AUTHENTICATING) {
console.log('Authenticating');
} else if (status === Strophe.Status.AUTHFAIL) {
console.log('Authenticating Failed');
} else if (status === Strophe.Status.DISCONNECTING) {
console.log('Disconnecting');
} else if (status === Strophe.Status.ATTACHED) {
console.log('Attached');
}
});
});
});
});
require(["jquery", "converse"], function($) {});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment