You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/02/09 10:26:22 UTC

[23/51] [abbrv] ignite git commit: IGNITE-843 es6.

IGNITE-843 es6.


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

Branch: refs/heads/ignite-843-rc3
Commit: 7612c220488a61a6ad48ea89b85bc64f450f267a
Parents: a84f6b6
Author: Andrey <an...@gridgain.com>
Authored: Mon Feb 8 17:13:46 2016 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Feb 8 17:13:46 2016 +0700

----------------------------------------------------------------------
 .../main/js/app/modules/user/Auth.service.js    | 96 ++++++++++----------
 1 file changed, 46 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7612c220/modules/control-center-web/src/main/js/app/modules/user/Auth.service.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/app/modules/user/Auth.service.js b/modules/control-center-web/src/main/js/app/modules/user/Auth.service.js
index 3e194e7..0690cfa 100644
--- a/modules/control-center-web/src/main/js/app/modules/user/Auth.service.js
+++ b/modules/control-center-web/src/main/js/app/modules/user/Auth.service.js
@@ -16,62 +16,58 @@
  */
 
 export default ['Auth', ['$http', '$rootScope', '$state', '$common', 'IgniteGettingStarted', 'User',
-    function($http, $root, $state, $common, gettingStarted, User) {
-    let _auth = false;
+    ($http, $root, $state, $common, gettingStarted, User) => {
+        let _auth = false;
 
-    try {
-        _auth = localStorage.authorized === 'true';
-    }
-    catch (ignore) {
-        // No-op.
-    }
-
-    function _authorized(value) {
         try {
-            return _auth = localStorage.authorized = !!value;
-        } catch (ignore) {
-            return _auth = !!value;
+            _auth = localStorage.authorized === 'true';
+        }
+        catch (ignore) {
+            // No-op.
         }
-    }
 
-    return {
-        get authorized() {
-            return _auth;
-        },
-        set authorized(auth) {
-            _authorized(auth);
-        },
-        auth(action, userInfo) {
-            $http.post('/api/v1/' + action, userInfo)
-                .then(User.read)
-                .then((user) => {
-                    if (action !== 'password/forgot') {
-                        _authorized(true);
+        function _authorized(value) {
+            try {
+                return _auth = localStorage.authorized = !!value;
+            } catch (ignore) {
+                return _auth = !!value;
+            }
+        }
 
-                        $root.$broadcast('user', user);
+        return {
+            get authorized() {
+                return _auth;
+            },
+            set authorized(auth) {
+                _authorized(auth);
+            },
+            auth(action, userInfo) {
+                $http.post('/api/v1/' + action, userInfo)
+                    .then(User.read)
+                    .then((user) => {
+                        if (action !== 'password/forgot') {
+                            _authorized(true);
 
-                        $state.go('base.configuration.clusters');
+                            $root.$broadcast('user', user);
 
-                        $root.gettingStarted.tryShow();
-                    } else
-                        $state.go('password.send');
-                })
-                .catch(function(errMsg) {
-                    $common.showPopoverMessage(null, null, 'user_email', errMsg.data);
-                });
-        },
-        logout() {
-            $http.post('/api/v1/logout')
-                .then(function() {
-                    User.clean();
+                            $state.go('base.configuration.clusters');
 
-                    _authorized(false);
+                            $root.gettingStarted.tryShow();
+                        } else
+                            $state.go('password.send');
+                    })
+                    .catch((errMsg) => $common.showPopoverMessage(null, null, 'user_email', errMsg.data));
+            },
+            logout() {
+                $http.post('/api/v1/logout')
+                    .then(() => {
+                        User.clean();
 
-                    $state.go('login');
-                })
-                .catch(function(errMsg) {
-                    $common.showError(errMsg);
-                });
-        }
-    };
-}]];
+                        _authorized(false);
+
+                        $state.go('login');
+                    })
+                    .catch((errMsg) => $common.showError(errMsg));
+            }
+        };
+    }]];