changed login to ajax added error message for incorret login, closes #36

This commit is contained in:
Baris Soner Usakli
2013-06-25 20:55:02 -04:00
parent 8e10ce1924
commit 9b43f80ff8
4 changed files with 40 additions and 7 deletions

View File

@@ -11,4 +11,31 @@
document.location.href = target.getAttribute('data-url');
}
});
$('#login').on('click', function() {
var loginData = {
'username': $('#username').val(),
'password': $('#password').val(),
'_csrf': $('#csrf-token').val()
};
$.ajax({
type: "POST",
url: '/login',
data: loginData,
success: function(data, textStatus, jqXHR) {
$('#login-error-notify').hide();
window.location.replace("/");
},
error : function(data, textStatus, jqXHR) {
$('#login-error-notify').show().delay(1000).fadeOut(250);
},
dataType: 'json'
});
return false;
});
}());