You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/03/31 16:42:59 UTC

git commit: AMBARI-5283 Check bad credentials vs. aborted and present different message to user on login (ababiichuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk 1067ae5c4 -> a42d8ca88


AMBARI-5283 Check bad credentials vs. aborted and present different message to user on login (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a42d8ca8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a42d8ca8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a42d8ca8

Branch: refs/heads/trunk
Commit: a42d8ca885a765ed72aa749774c6dd137d07dad7
Parents: 1067ae5
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Mon Mar 31 17:40:55 2014 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Mon Mar 31 17:41:12 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/login_controller.js |  9 ++++++---
 ambari-web/app/messages.js                     |  3 ++-
 ambari-web/app/router.js                       | 11 ++++++++---
 3 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a42d8ca8/ambari-web/app/controllers/login_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/login_controller.js b/ambari-web/app/controllers/login_controller.js
index 32407c6..4f92dd2 100644
--- a/ambari-web/app/controllers/login_controller.js
+++ b/ambari-web/app/controllers/login_controller.js
@@ -35,10 +35,13 @@ App.LoginController = Em.Object.extend({
     App.get('router').login();
   },
 
-  postLogin: function (isAuthenticated) {
-    if (!isAuthenticated) {
+  postLogin: function (isConnected, isAuthenticated) {
+    if (!isConnected) {
+      console.log('Failed to connect to Ambari Server');
+      this.set('errorMessage', Em.I18n.t('login.error.bad.connection'));
+    } else if (!isAuthenticated) {
       console.log('Failed to login as: ' + this.get('loginName'));
-      this.set('errorMessage', Em.I18n.t('login.error'));
+      this.set('errorMessage', Em.I18n.t('login.error.bad.credentials'));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a42d8ca8/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index a0d1109..d68d742 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -259,7 +259,8 @@ Em.I18n.translations = {
   'login.header':'Sign in',
   'login.username':'Username',
   'login.loginButton':'Sign in',
-  'login.error':'Invalid username/password combination.',
+  'login.error.bad.credentials':'Unable to sign in. Invalid username/password combination.',
+  'login.error.bad.connection':'Unable to connect to Ambari Server. Confirm Ambari Server is running and you can reach Ambari Server from this machine.',
 
   'graphs.noData.title': 'No Data',
   'graphs.noData.message': 'There was no data available. Possible reasons include inaccessible Ganglia service.',

http://git-wip-us.apache.org/repos/asf/ambari/blob/a42d8ca8/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 3a1fbd5..e0971b1 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -195,7 +195,7 @@ App.Router = Em.Router.extend({
       App.usersMapper.map({"items": [data]});
       this.setUser(App.User.find(params.loginName));
       this.transitionTo(this.getSection());
-      controller.postLogin(true);
+      controller.postLogin(true,true);
     }
     else {
       App.ajax.send({
@@ -215,7 +215,12 @@ App.Router = Em.Router.extend({
     var controller = this.get('loginController');
     console.log("login error: " + error);
     this.setAuthenticated(false);
-    controller.postLogin(false);
+    if (request.status == 403) {
+      controller.postLogin(true, false);
+    } else {
+      controller.postLogin(false, false);
+    }
+
   },
 
   login2SuccessCallback: function (clusterResp, opt, params) {
@@ -226,7 +231,7 @@ App.Router = Em.Router.extend({
       App.usersMapper.map({"items": [params.loginData]});
       this.setUser(App.User.find(params.loginName));
       this.transitionTo(this.getSection());
-      controller.postLogin(true);
+      controller.postLogin(true,true);
     }
     else {
       controller.set('errorMessage', Em.I18n.t('router.hadoopClusterNotSetUp'));