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