Changes made to fix login error
[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>
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                 <style>
60                         .terms {
61                                 font-family: Verdana,Arial,Helvetica, sans-serif;
62                                 font-size: 9px;
63                         }
64                         .login-tbl {
65                                 border: 0px;
66                         }
67                         .login-txt {
68                             font-family: Arial;
69                             font-size: 14px;
70                             text-decoration: none;
71                         }
72                         .login-input-text {
73                                 width: 140px;
74                                 height:25px;
75                                 border-radius:7px;
76                                 padding-left:5px;                       
77                             font-family: Arial;
78                                 font-size: 14px;
79                         }
80                         .login-btn {
81                             cursor: pointer;
82                             background: #d97b34;
83                             background-image: -webkit-linear-gradient(top, #d97b34, #b8632b);
84                             background-image: -moz-linear-gradient(top, #d97b34, #b8632b);
85                             background-image: -ms-linear-gradient(top, #d97b34, #b8632b);
86                             background-image: -o-linear-gradient(top, #d97b34, #b8632b);
87                             background-image: linear-gradient(to bottom, #d97b34, #b8632b);
88                             -webkit-border-radius: 7;
89                             -moz-border-radius: 7;
90                             border-radius: 7px;
91                             font-family: Arial;
92                             color: #ffffff;
93                             font-size: 13px;
94                             padding: 4px 10px 4px 10px;
95                             text-decoration: none;
96                         }
97                 </style>
98         </head>
99         <body style="padding-top: 15px;">
100         <% 
101        String frontUrl = SystemProperties.getProperty(EPSystemProperties.FE_URL);
102     %>
103         <div>
104                 <div class="centered style="-webkit-transform: translateZ(0);background:white, z-index:0;">
105                         <div align="center" id="errorInfo" style="display:none; float:left; font-family: Arial; font-size:12px; margin-left:5px">
106                                 <span style="color:red">Invalid username or password. Please try again.</span>
107                         </div>
108                         <br/>
109                         <div align="center" style="margin-left:auto;margin-right:auto;width:40%;padding:6px;background-color:white">
110                         <img src="static/fusion/images/onap-portal-logo.png" height="250"/>
111                                 <br>
112                                 <div style="opacity: 0.7;">
113                                         <table class="login-tbl">
114                                                 <tr>
115                                                         <td>    
116                                                                 <label class="login-txt">Login ID:</label>
117                                                         </td>
118                                                         <td>
119                                                                 <input type="text" class="login-input-text" id="loginId" maxlength="30" />
120                                                         </td>
121                                                 </tr>
122                                                 <tr>
123                                                         <td>
124                                                                 <label class="login-txt">Password:</label>
125                                                         </td>
126                                                         <td>
127                                                                 <input type="password" class="login-input-text" id="password" maxlength="30" 
128                                                                         onkeydown="if (event.keyCode == 13) document.getElementById('loginBtn').click()"/>
129                                                         </td>
130                                                 </tr>
131                                         </table> 
132                                         <br />
133                                         <a class="login-btn" id="loginBtn">LOGIN</a>
134                                 </div>
135                                 <br>
136                         </div>
137                 </div>
138                 <br/><br/><br/><br/><br/><br/><br/>
139     </div>
140     </body>
141         
142         <script>
143                 $( document ).ready(function() {
144                         $(".login-btn").click(function(){
145                                 var loginIdVal = $("#loginId").val();
146                                 var passwordVal = $("#password").val();
147                                 var postData={loginId:loginIdVal,password:passwordVal};
148                                 $.ajax({
149                                         url: "open_source/login?",
150                                         type : "POST",
151                                         dataType: 'json',
152                                         contentType: 'application/json',
153                                         data: JSON.stringify(postData),                
154                                         success:function (response){
155                                           if(response.success=="success"){
156                                                 //window.location.href = 'applicationsHome';
157                                                 window.location.href= "<%=frontUrl%>",
158                                                 sessionStorage.setItem('userId',loginIdVal)
159                                           }else{
160                                                 $("#errorInfo span").text(response);
161                                                 //$("#errorInfo").text = response;
162                                                 $("#errorInfo").show();
163                                           }
164                                         },
165                                         error:function( jqXHR, status,error ){
166                                                 $("#errorInfo").show();
167                                         }
168                                                 
169                                 });
170                         });
171                 });
172         </script>
173 </html>