aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources/META-INF
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/META-INF')
-rw-r--r--src/main/resources/META-INF/resources/designer/authenticate.html12
-rw-r--r--src/main/resources/META-INF/resources/designer/invalid_login.html7
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/authcontroller.js40
3 files changed, 13 insertions, 46 deletions
diff --git a/src/main/resources/META-INF/resources/designer/authenticate.html b/src/main/resources/META-INF/resources/designer/authenticate.html
index a6c2cb8da..5429dced8 100644
--- a/src/main/resources/META-INF/resources/designer/authenticate.html
+++ b/src/main/resources/META-INF/resources/designer/authenticate.html
@@ -18,7 +18,6 @@
limitations under the License.
============LICENSE_END============================================
===================================================================
-
-->
<style>
.divRow {
@@ -41,20 +40,13 @@
<head>
<title>CLDS</title>
</head>
-<div ng-controller="AuthenticateCtrl">
+<div ng-controller="AuthenticateCtrl" ng-init="authenticate()">
<div id='head'>
<div ng-include="'menu_simplified.html'"></div>
</div>
<div id='main'>
- <div class="divRow"><b>Welcome to Clamp. Please login first.</b></div>
- <div class="divForm">
- <form ng-submit="authenticate()" method="post" autocomplete="off">
- <div class="divFormRow"><label>User Name : <input type="text" ng-model="username" name="username"/> </label></div>
- <div class="divFormRow"><label>Password: <input type="password" ng-model="password" name="password"/> </label></div>
- <div class="divFormRow"><input type="submit" value=" Sign In"/></div>
- </form>
- </div>
+ <div class="divRow"><b>Welcome to Clamp.</b></div>
</div>
</div>
diff --git a/src/main/resources/META-INF/resources/designer/invalid_login.html b/src/main/resources/META-INF/resources/designer/invalid_login.html
index f42be51ec..5d6e955b7 100644
--- a/src/main/resources/META-INF/resources/designer/invalid_login.html
+++ b/src/main/resources/META-INF/resources/designer/invalid_login.html
@@ -34,12 +34,7 @@
</head>
<div>
<div class="divRow"><b>Login Failed!</b></div>
- <div class="divRow"><b>Please make sure your login and password are correct.
- If you don't have the login credential, please contact CLAMP administrator.</b></div>
+ <div class="divRow"><b>You are not authorized to access CLAMP UI, please contact CLAMP administrator.</b></div>
<div class="divRow">To login again, please click <a href="/designer/index.html"/>Login</a></div>
</div>
-
-
-
-
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 ac8919801..c1a52f9b1 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/authcontroller.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/authcontroller.js
@@ -18,7 +18,7 @@
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
'use strict';
@@ -27,47 +27,27 @@ function AuthenticateCtrl($scope, $rootScope, $window, $resource, $http, $locati
console.log("//////////AuthenticateCtrl");
$scope.getInclude = function() {
console.log("getInclude011111111");
- var invalidUser = $window.localStorage.getItem("isInvalidUser");
+ var invalidUser = $window.localStorage.getItem("invalidUser");
var isAuth = $window.localStorage.getItem("isAuth");
-
- if (invalidUser != null && invalidUser == 'true') {
- console.log("Authentication failed");
- $window.localStorage.removeItem("isInvalidUser");
- window.location.href = "/designer/invalid_login.html";
- } else if (isAuth == null || isAuth == 'false') {
+ if (invalidUser == 'true')
+ return "invalid_login.html";
+ else if (isAuth == null || isAuth == 'false') {
return "authenticate.html";
}
- // Reassign the login user info, to be used in menu.html
- $rootScope.loginuser = $window.localStorage.getItem("loginuser");
return "utmdashboard.html";
};
$scope.authenticate = function() {
- var username = $scope.username;
- var pass = $scope.password;
- if (!username || !pass) {
- console.log("Invalid username/password");
- $window.localStorage.setItem("isInvalidUser", true);
- return;
- }
- var headers = username ? {
- authorization: "Basic " +
- btoa(username + ":" + pass)
- } : {};
- // send request to a test API with the username/password to verify the authorization
- $http.get('/restservices/clds/v1/user/testUser', {
- headers: headers
+ // 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);
- $window.localStorage.setItem("loginuser", $scope.username);
- $rootScope.loginuser = $scope.username;
- } else {
- $window.localStorage.removeItem("isInvalidUser", true);
- }
+ $rootScope.loginuser = data;
+ }
callback && callback();
}).error(function() {
- $window.localStorage.removeItem("isInvalidUser", true);
+ $window.localStorage.setItem("invalidUser", true);
callback && callback();
});
};