mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-11-17 14:55:05 -05:00
35 lines
903 B
JavaScript
35 lines
903 B
JavaScript
$('#loginbox form').on('submit', function (e) {
|
|
var jid = $('#jid').val();
|
|
if (SERVER_CONFIG.domain && jid.indexOf('@') == -1)
|
|
jid += "@" + SERVER_CONFIG.domain;
|
|
var password = $('#password').val();
|
|
var connURL = SERVER_CONFIG.wss ? SERVER_CONFIG.wss : $('#connURL').val();
|
|
|
|
var transport;
|
|
var wsURL = '';
|
|
var boshURL = '';
|
|
if (connURL.indexOf('http') === 0) {
|
|
boshURL = connURL;
|
|
transport = 'bosh';
|
|
} else if (connURL.indexOf('ws') === 0) {
|
|
wsURL = connURL;
|
|
transport = 'websocket';
|
|
}
|
|
|
|
localStorage.config = JSON.stringify({
|
|
jid: jid,
|
|
server: jid.slice(jid.indexOf('@') + 1),
|
|
wsURL: wsURL,
|
|
boshURL: boshURL,
|
|
transport: transport,
|
|
credentials: {
|
|
password: password
|
|
}
|
|
});
|
|
|
|
window.location = '/';
|
|
|
|
e.preventDefault();
|
|
return false;
|
|
});
|