Deliver centralized role management feature
[portal.git] / ecomp-portal-BE-os / src / main / webapp / WEB-INF / jsp / login.jsp
1 <%--
2   ================================================================================
3   eCOMP Portal
4   ================================================================================
5   Copyright (C) 2017 AT&T Intellectual Property
6   ================================================================================
7   Licensed under the Apache License, Version 2.0 (the "License");
8   you may not use this file except in compliance with the License.
9   You may obtain a copy of the License at
10   
11        http://www.apache.org/licenses/LICENSE-2.0
12   
13   Unless required by applicable law or agreed to in writing, software
14   distributed under the License is distributed on an "AS IS" BASIS,
15   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   See the License for the specific language governing permissions and
17   limitations under the License.
18   ================================================================================
19   --%>
20 <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
21 <%@ taglib prefix="c"      uri="http://java.sun.com/jsp/jstl/core" %>
22 <%@ taglib prefix="fmt"    uri="http://java.sun.com/jsp/jstl/fmt" %>
23 <%@ page import="org.openecomp.portalsdk.core.util.SystemProperties" %>
24 <%@ page import="org.openecomp.portalapp.portal.utils.EPSystemProperties" %>
25 <c:set var="title" value="Login" />
26 <c:set var="isMobileEnabled"
27         value="<%=(SystemProperties.getProperty(SystemProperties.MOBILE_ENABLE)!= null && SystemProperties.getProperty(SystemProperties.MOBILE_ENABLE).trim().equals(\"true\"))%>" />
28
29 <!DOCTYPE html>
30 <html ng-app="abs">
31         <head>
32                 <link rel="shortcut icon" href="assets/images/1cc621d2.ecomp_logo.png">
33             <title>
34               Login
35         </title>
36                 <meta charset="utf-8">
37                 <meta http-equiv="X-UA-Compatible" content="IE=edge">
38                 <meta name="viewport" content="width=device-width, initial-scale=1"> 
39         <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
40                 <script src="static/js/jquery-1.10.2.js" type="text/javascript"></script>
41                 <script src= "static/ebz/angular_js/angular.js"></script> 
42                 <script src= "static/ebz/angular_js/angular-sanitize.js"></script>
43                 <script src= "static/ebz/angular_js/gestures.js"></script>
44                 <style>
45                         .terms {
46                                 font-family: Verdana,Arial,Helvetica, sans-serif;
47                                 font-size: 9px;
48                         }
49                         .login-tbl {
50                                 border: 0px;
51                         }
52                         .login-txt {
53                             font-family: Arial;
54                             font-size: 14px;
55                             text-decoration: none;
56                         }
57                         .login-input-text {
58                                 width: 140px;
59                                 height:25px;
60                                 border-radius:7px;
61                                 padding-left:5px;                       
62                             font-family: Arial;
63                                 font-size: 14px;
64                         }
65                         .login-btn {
66                             cursor: pointer;
67                             background: #d97b34;
68                             background-image: -webkit-linear-gradient(top, #d97b34, #b8632b);
69                             background-image: -moz-linear-gradient(top, #d97b34, #b8632b);
70                             background-image: -ms-linear-gradient(top, #d97b34, #b8632b);
71                             background-image: -o-linear-gradient(top, #d97b34, #b8632b);
72                             background-image: linear-gradient(to bottom, #d97b34, #b8632b);
73                             -webkit-border-radius: 7;
74                             -moz-border-radius: 7;
75                             border-radius: 7px;
76                             font-family: Arial;
77                             color: #ffffff;
78                             font-size: 13px;
79                             padding: 4px 10px 4px 10px;
80                             text-decoration: none;
81                         }
82                 </style>
83         </head>
84         <body style="padding-top: 15px;">
85         <% 
86        String frontUrl = SystemProperties.getProperty(EPSystemProperties.FE_URL);
87     %>
88         <div ng-controller="externalLoginController">
89                 <div class="centered style="-webkit-transform: translateZ(0);background:white, z-index:0;">
90                         <div align="center" id="errorInfo" style="display:none; float:left; font-family: Arial; font-size:12px; margin-left:5px">
91                                 <span style="color:red">Invalid username or password. Please try again.</span>
92                         </div>
93                         <br/>
94                         <div align="center" style="margin-left:auto;margin-right:auto;width:40%;padding:6px;background-color:white">
95                         <img src="static/fusion/images/onap-portal-logo.png" height="250"/>
96                                 <br>
97                                 <div style="opacity: 0.7;">
98                                         <table class="login-tbl">
99                                                 <tr>
100                                                         <td>    
101                                                                 <label class="login-txt">Login ID:</label>
102                                                         </td>
103                                                         <td>
104                                                                 <input type="text" class="login-input-text" ng-model="loginId" maxlength="30" />
105                                                         </td>
106                                                 </tr>
107                                                 <tr>
108                                                         <td>
109                                                                 <label class="login-txt">Password:</label>
110                                                         </td>
111                                                         <td>
112                                                                 <input type="password" class="login-input-text" ng-model="password" maxlength="30" 
113                                                                         onkeydown="if (event.keyCode == 13) document.getElementById('loginBtn').click()"/>
114                                                         </td>
115                                                 </tr>
116                                         </table> 
117                                         <br />
118                                         <a class="login-btn" id="loginBtn" ng-click="loginExternal();">LOGIN</a>
119                                 </div>
120                                 <br>
121                         </div>
122                 </div>
123                 <br/><br/><br/><br/><br/><br/><br/>
124     </div>
125     </body>
126 <script>
127 var app=angular.module("abs", []);
128 app.controller("externalLoginController", function ($scope) { 
129         // Table Data
130         
131         $scope.viewPerPage = 200;
132         $scope.currentPage = 2;
133         $scope.totalPage;
134         $scope.searchCategory = "";
135         $scope.searchString = "";
136         $scope.loginId="";
137         $scope.password="";
138         $scope.loginError=true;
139         $scope.viewPerPage = 200;
140         $scope.currentPage = 2;
141         $scope.totalPage;
142         $scope.searchCategory = "";
143         $scope.searchString = "";
144         $scope.loginId="";
145         $scope.password="";
146         $scope.loginUrl = "";
147         
148         $scope.loginExternal = function() {
149                 var postData={loginId:$scope.loginId,password:$scope.password};
150                 $.ajax({
151                     url: "open_source/login?",
152                 type : "POST",
153                                  dataType: 'json',
154                                  contentType: 'application/json',
155                                  data: JSON.stringify(postData),                
156                 success:function (response){
157                   if(response.success=="success"){
158                     //window.location.href = 'applicationsHome';
159                     window.location.href= "<%=frontUrl%>"
160                   }else{
161                         $("#errorInfo span").text(response);
162                         //$("#errorInfo").text = response;
163                         $("#errorInfo").show();
164                   }
165                 },
166                 error:function( jqXHR, status,error ){
167                         $("#errorInfo").show();
168                 }
169                 
170         });
171
172     };
173         /**
174         $scope.loginExternal = function() {
175
176         
177                   var redirectUrl = "login_external/login";
178           var form = $('<form action="' + redirectUrl + '" method="post">' +
179                   '<input type="hidden" name="loginId" value='+$scope.loginId+' />' +
180                   '<input type="hidden" name="password" value='+$scope.password+' />' +
181                   '</form>');
182                   
183                   $('body').append(form);
184                   $(form).submit();
185          
186
187     };
188     */  
189 });
190 </script>
191         
192 </html>