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) {
|
switch (textStatus) {
|
||||||
case "timeout":
|
case "timeout":
|
||||||
failure("Couldn't connect to the server (timeout).");
|
failure("Couldn't connect to the server (timeout).", xhr);
|
||||||
break;
|
break;
|
||||||
case "error":
|
case "error":
|
||||||
failure("Couldn't connect to the server (error).");
|
failure("Couldn't connect to the server (error).", xhr);
|
||||||
break;
|
break;
|
||||||
case "parseerror":
|
case "parseerror":
|
||||||
failure("The server sent a malformed response.");
|
failure("The server sent a malformed response.", xhr);
|
||||||
break;
|
break;
|
||||||
default:
|
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) {
|
function checkAndSave(username, password) {
|
||||||
app.preloader.show();
|
app.preloader.show();
|
||||||
|
|
||||||
callAPI("ping", {
|
callAPIRawResponse("ping", {
|
||||||
username: username,
|
username: username,
|
||||||
password: password
|
password: password
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
@ -32,9 +32,13 @@ function checkAndSave(username, password) {
|
|||||||
app.preloader.hide();
|
app.preloader.hide();
|
||||||
app.dialog.alert(msg, "Error");
|
app.dialog.alert(msg, "Error");
|
||||||
});
|
});
|
||||||
}, function (msg) {
|
}, function (msg, xhr) {
|
||||||
app.preloader.hide();
|
app.preloader.hide();
|
||||||
|
if (xhr.status == 401) {
|
||||||
|
app.dialog.alert("Login incorrect.", "Error");
|
||||||
|
} else {
|
||||||
app.dialog.alert(msg, "Error");
|
app.dialog.alert(msg, "Error");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,3 +48,9 @@ function setupAccount() {
|
|||||||
|
|
||||||
checkAndSave(username, password);
|
checkAndSave(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#password").on("keyup", function (evt) {
|
||||||
|
if (evt.keyCode == 13) {
|
||||||
|
setupAccount();
|
||||||
|
}
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user