webapi-eca/webpages/handlers/js/login.js

30 lines
811 B
JavaScript

// Generated by CoffeeScript 1.6.3
(function() {
var fOnLoad;
fOnLoad = function() {
document.title = 'Login';
$('#pagetitle').text('Login!');
if (!window.CryptoJS) {
$('#info').text('CryptoJS library missing! Are you connected to the internet?');
}
return $('#but_submit').click(function() {
var data, hp;
hp = CryptoJS.SHA3($('#password').val(), {
outputLength: 512
});
data = {
username: $('#username').val(),
password: hp.toString()
};
return $.post('/login', data).done(function(data) {
return window.location.href = document.URL;
}).fail(function(err) {
return alert('Authentication not successful!');
});
});
};
window.addEventListener('load', fOnLoad, true);
}).call(this);