1b269d80c046107b1d533e2e134ddf620013f4a9
[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         <link rel="stylesheet" type="text/css" href="static/fusion/css/jquery-ui.css">
41                 <script src="static/js/jquery-1.10.2.js" type="text/javascript"></script>
42                 <script src= "static/ebz/angular_js/angular.js"></script> 
43                 <script src= "static/ebz/angular_js/angular-sanitize.js"></script>
44                 <script src= "static/ebz/angular_js/app.js"></script>
45                 <script src= "static/ebz/angular_js/gestures.js"></script>
46                 <style>
47                         .terms {
48                                 font-family: Verdana,Arial,Helvetica, sans-serif;
49                                 font-size: 9px;
50                         }
51                         .login-tbl {
52                                 border: 0px;
53                         }
54                         .login-txt {
55                             font-family: Arial;
56                             font-size: 14px;
57                             text-decoration: none;
58                         }
59                         .login-input-text {
60                                 width: 140px;
61                                 height:25px;
62                                 border-radius:7px;
63                                 padding-left:5px;                       
64                             font-family: Arial;
65                                 font-size: 14px;
66                         }
67                         .login-btn {
68                             cursor: pointer;
69                             background: #d97b34;
70                             background-image: -webkit-linear-gradient(top, #d97b34, #b8632b);
71                             background-image: -moz-linear-gradient(top, #d97b34, #b8632b);
72                             background-image: -ms-linear-gradient(top, #d97b34, #b8632b);
73                             background-image: -o-linear-gradient(top, #d97b34, #b8632b);
74                             background-image: linear-gradient(to bottom, #d97b34, #b8632b);
75                             -webkit-border-radius: 7;
76                             -moz-border-radius: 7;
77                             border-radius: 7px;
78                             font-family: Arial;
79                             color: #ffffff;
80                             font-size: 13px;
81                             padding: 4px 10px 4px 10px;
82                             text-decoration: none;
83                         }
84                 </style>
85         </head>
86         <body style="padding-top: 15px;">
87         <% 
88        String frontUrl = SystemProperties.getProperty(EPSystemProperties.FE_URL);
89     %>
90         <div ng-controller="externalLoginController">
91                 <div class="centered style="-webkit-transform: translateZ(0);background:white, z-index:0;">
92                         <div align="center" id="errorInfo" style="display:none; float:left; font-family: Arial; font-size:12px; margin-left:5px">
93                                 <span style="color:red">Invalid username or password. Please try again.</span>
94                         </div>
95                         <br/>
96                         <div align="center" style="margin-left:auto;margin-right:auto;width:40%;padding:6px;background-color:white">
97                         <img src="static/fusion/images/onap-portal-logo.png" height="250"/>
98                                 <br>
99                                 <div style="opacity: 0.7;">
100                                         <table class="login-tbl">
101                                                 <tr>
102                                                         <td>    
103                                                                 <label class="login-txt">Login ID:</label>
104                                                         </td>
105                                                         <td>
106                                                                 <input type="text" class="login-input-text" ng-model="loginId" maxlength="30" />
107                                                         </td>
108                                                 </tr>
109                                                 <tr>
110                                                         <td>
111                                                                 <label class="login-txt">Password:</label>
112                                                         </td>
113                                                         <td>
114                                                                 <input type="password" class="login-input-text" ng-model="password" maxlength="30" 
115                                                                         onkeydown="if (event.keyCode == 13) document.getElementById('loginBtn').click()"/>
116                                                         </td>
117                                                 </tr>
118                                         </table> 
119                                         <br />
120                                         <a class="login-btn" id="loginBtn" ng-click="loginExternal();">LOGIN</a>
121                                 </div>
122                                 <br>
123                         </div>
124                 </div>
125                 <br/><br/><br/><br/><br/><br/><br/>
126     </div>
127     </body>
128 <script>
129 app.controller("externalLoginController", function ($scope) { 
130         // Table Data
131         
132         $scope.viewPerPage = 200;
133         $scope.currentPage = 2;
134         $scope.totalPage;
135         $scope.searchCategory = "";
136         $scope.searchString = "";
137         $scope.loginId="";
138         $scope.password="";
139         $scope.loginError=true;
140         $scope.viewPerPage = 200;
141         $scope.currentPage = 2;
142         $scope.totalPage;
143         $scope.searchCategory = "";
144         $scope.searchString = "";
145         $scope.loginId="";
146         $scope.password="";
147         $scope.loginUrl = "";
148         
149         $scope.loginExternal = function() {
150                 var postData={loginId:$scope.loginId,password:$scope.password};
151                 $.ajax({
152                     url: "open_source/login?",
153                 type : "POST",
154                                  dataType: 'json',
155                                  contentType: 'application/json',
156                                  data: JSON.stringify(postData),                
157                 success:function (response){
158                   if(response.success=="success"){
159                     //window.location.href = 'applicationsHome';
160                     window.location.href= "<%=frontUrl%>"
161                   }else{
162                         $("#errorInfo span").text(response);
163                         //$("#errorInfo").text = response;
164                         $("#errorInfo").show();
165                   }
166                 },
167                 error:function( jqXHR, status,error ){
168                         $("#errorInfo").show();
169                 }
170                 
171         });
172
173     };
174         /**
175         $scope.loginExternal = function() {
176
177         
178                   var redirectUrl = "login_external/login";
179           var form = $('<form action="' + redirectUrl + '" method="post">' +
180                   '<input type="hidden" name="loginId" value='+$scope.loginId+' />' +
181                   '<input type="hidden" name="password" value='+$scope.password+' />' +
182                   '</form>');
183                   
184                   $('body').append(form);
185                   $(form).submit();
186          
187
188     };
189     */  
190 });
191 </script>
192         
193 </html>