Give proper "login incorrect" error on signin page

master
Skylar Ittner 5 years ago
parent 709540eee6
commit 332ed3e38a

@ -87,16 +87,16 @@ function callAPIRawResponse(action, data, success, failure) {
}
switch (textStatus) {
case "timeout":
failure("Couldn't connect to the server (timeout).");
failure("Couldn't connect to the server (timeout).", xhr);
break;
case "error":
failure("Couldn't connect to the server (error).");
failure("Couldn't connect to the server (error).", xhr);
break;
case "parseerror":
failure("The server sent a malformed response.");
failure("The server sent a malformed response.", xhr);
break;
default:
failure("Couldn't connect to the server.");
failure("Couldn't connect to the server.", xhr);
}
}
});

@ -11,7 +11,7 @@ $('#username').on("keyup", function () {
function checkAndSave(username, password) {
app.preloader.show();
callAPI("ping", {
callAPIRawResponse("ping", {
username: username,
password: password
}, function (data) {
@ -32,9 +32,13 @@ function checkAndSave(username, password) {
app.preloader.hide();
app.dialog.alert(msg, "Error");
});
}, function (msg) {
}, function (msg, xhr) {
app.preloader.hide();
app.dialog.alert(msg, "Error");
if (xhr.status == 401) {
app.dialog.alert("Login incorrect.", "Error");
} else {
app.dialog.alert(msg, "Error");
}
});
}
@ -43,4 +47,10 @@ function setupAccount() {
var password = $("#password").val();
checkAndSave(username, password);
}
}
$("#password").on("keyup", function (evt) {
if (evt.keyCode == 13) {
setupAccount();
}
})
Loading…
Cancel
Save