Fix login error message
Respose for invalid credentials changed and login page
was no longer displaying the correct error message to
the user when invalid credentials were entered.
Resolves openbmc/phosphor-webui#72
Tested: Logged in with incorrect credentials and saw the
correct message. Also logged in with an unreachable
host and saw that that message was displaying
correctly.
Change-Id: I65cc6d6a061986568aded09555c5f75bcd59fe56
Signed-off-by: beccabroek <beccabroek@gmail.com>
diff --git a/app/common/services/userModel.js b/app/common/services/userModel.js
index 40a34de..f73c7a8 100644
--- a/app/common/services/userModel.js
+++ b/app/common/services/userModel.js
@@ -25,8 +25,8 @@
response && response.data && response.data.data &&
response.data.data.description) {
callback(false, response.data.data.description);
- } else if (response && response.message) {
- callback(false, response.message);
+ } else if (response && response.statusText) {
+ callback(false, response.statusText);
} else if (error) {
callback(false, 'Server unreachable');
} else {
diff --git a/app/login/controllers/login-controller.js b/app/login/controllers/login-controller.js
index 518ede8..7867a0c 100644
--- a/app/login/controllers/login-controller.js
+++ b/app/login/controllers/login-controller.js
@@ -46,7 +46,7 @@
$window.location.href = next;
}
} else {
- if (description === 'Invalid username or password') {
+ if (description === 'Unauthorized') {
$scope.invalidCredentials = true;
} else {
$scope.serverUnreachable = true;