[PORTAL-7] Rebase
[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-btn {
52                             cursor: pointer;
53                             background: #d97b34;
54                             background-image: -webkit-linear-gradient(top, #d97b34, #b8632b);
55                             background-image: -moz-linear-gradient(top, #d97b34, #b8632b);
56                             background-image: -ms-linear-gradient(top, #d97b34, #b8632b);
57                             background-image: -o-linear-gradient(top, #d97b34, #b8632b);
58                             background-image: linear-gradient(to bottom, #d97b34, #b8632b);
59                             -webkit-border-radius: 7;
60                             -moz-border-radius: 7;
61                             border-radius: 7px;
62                             font-family: Arial;
63                             color: #ffffff;
64                             font-size: 13px;
65                             padding: 4px 10px 4px 10px;
66                             text-decoration: none;
67                         }
68                 </style>
69         </head>
70         <body style="padding-top: 15px;">
71         <% 
72        String frontUrl = SystemProperties.getProperty(EPSystemProperties.FE_URL);
73     %>
74         <div ng-controller="externalLoginController">
75                 <div class="centered style="-webkit-transform: translateZ(0);background:white, z-index:0;">
76                         <div align="center" id="errorInfo" style="display:none;float:left;font-size:12px;margin-left:5px"><span style="color:red">Invaild username or password, Please try again</span></div>
77                         <br/>
78                         <div align="center" style="margin-left:auto;margin-right:auto;width:40%;padding:6px;opacity:0.7;background-color:white">
79                         <img src="static/fusion/images/ecomp-login.jpg" height="250"/>
80                                 <br>
81                                 <label>
82                                         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="form-field__label">Login ID:</label>
83                                 </label>
84                                 <input  type="text" class="fn-ebz-text" ng-model="loginId" style="width: 140px;height:25px;border-radius:7px;font-size:18px;padding-left:5px;"
85                                         maxlength="30" />
86                                 <br/>
87                                 <br/>
88                                 <label >&nbsp;Password:</label>
89                                 <input type="password" class="span3" ng-model="password" style="width: 140px;height:25px;border-radius:7px;font-size:18px;padding-left:5px;"
90                                         maxlength="30" onkeydown="if (event.keyCode == 13) document.getElementById('loginBtn').click()"/> 
91                                 <br />
92                                 <br />
93                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
94                                 <a class="login-btn" id="loginBtn" ng-click="loginExternal();">LOGIN</a>
95                                 <br>
96                         </div>
97                 </div>
98                 <br/><br/><br/><br/><br/><br/><br/>
99     </div>
100     </body>
101 <script>
102 app.controller("externalLoginController", function ($scope) { 
103         // Table Data
104         
105         $scope.viewPerPage = 200;
106         $scope.currentPage = 2;
107         $scope.totalPage;
108         $scope.searchCategory = "";
109         $scope.searchString = "";
110         $scope.loginId="";
111         $scope.password="";
112         $scope.loginError=true;
113         $scope.viewPerPage = 200;
114         $scope.currentPage = 2;
115         $scope.totalPage;
116         $scope.searchCategory = "";
117         $scope.searchString = "";
118         $scope.loginId="";
119         $scope.password="";
120         $scope.loginUrl = "";
121         
122         $scope.loginExternal = function() {
123                 var postData={loginId:$scope.loginId,password:$scope.password};
124                 $.ajax({
125                     url: "open_source/login?",
126                 type : "POST",
127                                  dataType: 'json',
128                                  contentType: 'application/json',
129                                  data: JSON.stringify(postData),                
130                 success:function (response){
131                   if(response.success=="success"){
132                     //window.location.href = 'applicationsHome';
133                     window.location.href= "<%=frontUrl%>"
134                   }else{
135                         $("#errorInfo span").text(response);
136                         //$("#errorInfo").text = response;
137                         $("#errorInfo").show();
138                   }
139                 },
140                 error:function( jqXHR, status,error ){
141                         $("#errorInfo").show();
142                 }
143                 
144         });
145
146     };
147         /**
148         $scope.loginExternal = function() {
149
150         
151                   var redirectUrl = "login_external/login";
152           var form = $('<form action="' + redirectUrl + '" method="post">' +
153                   '<input type="hidden" name="loginId" value='+$scope.loginId+' />' +
154                   '<input type="hidden" name="password" value='+$scope.password+' />' +
155                   '</form>');
156                   
157                   $('body').append(form);
158                   $(form).submit();
159          
160
161     };
162     */  
163 });
164 </script>
165         
166 </html>