1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-14 21:45:08 -05:00
kaiwa/public/js/login.js

33 lines
763 B
JavaScript
Raw Normal View History

2013-09-05 19:53:23 -04:00
$('#loginbox form').on('submit', function (e) {
var jid = $('#jid').val();
var password = $('#password').val();
2014-02-18 23:44:15 -05:00
var connURL = $('#connURL').val();
2014-02-24 16:54:08 -05:00
var transport;
2014-02-18 23:44:15 -05:00
var wsURL = '';
var boshURL = '';
2014-02-24 16:54:08 -05:00
if (connURL.indexOf('http') === 0) {
2014-02-18 23:44:15 -05:00
boshURL = connURL;
2014-02-24 16:54:08 -05:00
transport = 'bosh';
} else if (connURL.indexOf('ws') === 0) {
2014-02-26 15:46:51 -05:00
wsURL = connURL;
2014-02-24 16:54:08 -05:00
transport = 'websocket';
2014-02-18 23:44:15 -05:00
}
2013-09-05 19:53:23 -04:00
localStorage.config = JSON.stringify({
jid: jid,
server: jid.slice(jid.indexOf('@') + 1),
wsURL: wsURL,
2014-02-18 23:44:15 -05:00
boshURL: boshURL,
2014-02-24 16:54:08 -05:00
transport: transport,
2013-09-05 19:53:23 -04:00
credentials: {
password: password
}
});
window.location = '/';
2014-02-18 23:44:15 -05:00
2013-09-05 19:53:23 -04:00
e.preventDefault();
return false;
});