Alert on wrong credentials (#76)

This commit is contained in:
calzoneman 2013-05-01 13:02:06 -05:00
parent 6a3e248ea5
commit ab3dd208c3
2 changed files with 8 additions and 1 deletions

1
api.js
View File

@ -156,6 +156,7 @@ function handleLogin(params, req, res) {
} }
else { else {
sendJSON(res, { sendJSON(res, {
error: "Invalid session",
success: false success: false
}); });
} }

View File

@ -949,7 +949,13 @@ function showLoginFrame() {
var data = e.data.substring(e.data.indexOf(":")+1); var data = e.data.substring(e.data.indexOf(":")+1);
data = JSON.parse(data); data = JSON.parse(data);
if(data.error) { if(data.error) {
alert(data.error); // Since this is the login page, invalid session implies bad credentials
if(data.error == "Invalid session") {
alert("Invalid username/password");
}
else {
alert(data.error);
}
} }
else if(data.success) { else if(data.success) {
session = data.session || ""; session = data.session || "";