Give proper "login incorrect" error on signin page
This commit is contained in:
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");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -44,3 +48,9 @@ function setupAccount() {
|
||||
|
||||
checkAndSave(username, password);
|
||||
}
|
||||
|
||||
$("#password").on("keyup", function (evt) {
|
||||
if (evt.keyCode == 13) {
|
||||
setupAccount();
|
||||
}
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user