X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fresources%2FMETA-INF%2Fresources%2Fdesigner%2Fscripts%2Fauthcontroller.js;h=d6387c8634758507ef89a9c7b9dc92a108ed70c8;hb=f451ca668c1de480211b380b58e1010c47f28008;hp=de364774d6cc6c4c4cba7a231dc5b4cf7dd815c8;hpb=628985aac4fbe481e20acb1a5578fe41749ea5ae;p=clamp.git diff --git a/src/main/resources/META-INF/resources/designer/scripts/authcontroller.js b/src/main/resources/META-INF/resources/designer/scripts/authcontroller.js index de364774..d6387c86 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/authcontroller.js +++ b/src/main/resources/META-INF/resources/designer/scripts/authcontroller.js @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,37 +20,41 @@ * =================================================================== * */ - 'use strict'; - -function AuthenticateCtrl($scope, $rootScope, $window, $resource, $http, $location, $cookies) { - console.log("//////////AuthenticateCtrl"); - $scope.getInclude = function() { - console.log("getInclude011111111"); - var invalidUser = $window.localStorage.getItem("invalidUser"); - var isAuth = $window.localStorage.getItem("isAuth"); - if (invalidUser == 'true') - return "invalid_login.html"; - else if (isAuth == null || isAuth == 'false') { - return "authenticate.html"; - } - return "utmdashboard.html"; - }; - - $scope.authenticate = function() { - // send request to a test API for authentication/authorization check - $http.get('/restservices/clds/v1/user/getUser', { - }).success(function(data) { - if (data) { - $window.localStorage.setItem("isAuth", true); - $rootScope.loginuser = data; - } - window.localStorage.removeItem("invalidUser"); - - }).error(function() { - $window.localStorage.setItem("invalidUser", true); - - }); - }; - -} +angular.module('clds-app').controller( +'AuthenticateCtrl', +[ +'$scope', +'$rootScope', +'$window', +'$resource', +'$http', +'$location', +'$cookies', +function($scope, $rootScope, $window, $resource, $http, $location, $cookies) { + console.log("//////////AuthenticateCtrl"); + $scope.getInclude = function() { + console.log("getInclude011111111"); + var invalidUser = $window.localStorage.getItem("invalidUser"); + var isAuth = $window.localStorage.getItem("isAuth"); + if (invalidUser == 'true') + return "invalid_login.html"; + else if (isAuth == null || isAuth == 'false') { + return "authenticate.html"; + } + return "utmdashboard.html"; + }; + $scope.authenticate = function() { + // send request to a test API for authentication/authorization check + $http.get('/restservices/clds/v1/user/getUser', {}).success( + function(data) { + if (data) { + $window.localStorage.setItem("isAuth", true); + $rootScope.loginuser = data; + } + window.localStorage.removeItem("invalidUser"); + }).error(function() { + $window.localStorage.setItem("invalidUser", true); + }); + }; +} ]); \ No newline at end of file