2015-12-25 00:57:58 +00:00
|
|
|
$("#login-form").on("submit", function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
login($("#email").val(), $("#password").val());
|
|
|
|
});
|
|
|
|
|
|
|
|
function login(email, password) {
|
2016-01-02 18:20:12 +00:00
|
|
|
$("#login").attr("disabled", "disabled");
|
2015-12-25 00:57:58 +00:00
|
|
|
$.post("/api/user/login", {
|
|
|
|
email: email,
|
|
|
|
password: password
|
|
|
|
}, function(data) {
|
|
|
|
if (data.success == 1) {
|
2016-01-02 19:49:48 +00:00
|
|
|
display_message("status", "success", "Success!", function() {
|
|
|
|
$("#login").removeAttr("disabled");
|
|
|
|
window.location = "#/account";
|
|
|
|
});
|
2016-01-02 18:20:12 +00:00
|
|
|
} else {
|
2016-01-02 18:26:02 +00:00
|
|
|
display_message("status", "danger", data.message, function() {$("#login").removeAttr("disabled");});
|
2015-12-25 00:57:58 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|