antonio@19359
|
1 |
|
ivan@10243
|
2 |
<%@ page import="java.util.Properties" %>
|
ivan@10243
|
3 |
<%@ page import="org.openbravo.base.HttpBaseServlet" %>
|
martin@13180
|
4 |
<%@ page import="org.openbravo.dal.core.OBContext"%>
|
ivan@10243
|
5 |
<%@ page import="org.openbravo.base.util.OBClassLoader" %>
|
ivan@10243
|
6 |
<%@ page import="org.openbravo.authentication.AuthenticationManager" %>
|
david@16035
|
7 |
<%@ page import="org.openbravo.client.kernel.KernelUtils" %>
|
ivan@16848
|
8 |
<%@ page import="org.openbravo.client.kernel.KernelConstants" %>
|
david@16035
|
9 |
<%@ page import="org.openbravo.dal.core.OBContext" %>
|
david@16035
|
10 |
<%@ page import="org.openbravo.model.ad.module.Module" %>
|
stefan@12524
|
11 |
<%@ page import="org.apache.log4j.Logger" %>
|
antonio@19359
|
12 |
<%@ page import="org.openbravo.model.ad.access.Role" %>
|
antonio@19368
|
13 |
<%@ page import="org.openbravo.model.ad.access.User" %>
|
antonio@19359
|
14 |
<%@ page import="org.openbravo.dal.service.OBDal" %>
|
antonio@19359
|
15 |
<%@ page import="org.openbravo.base.secureApp.VariablesSecureApp" %>
|
ivan@10243
|
16 |
<%@ page contentType="text/html; charset=UTF-8" %>
|
ivan@10243
|
17 |
<%
|
ivan@13687
|
18 |
/*
|
ivan@10243
|
19 |
*************************************************************************
|
ivan@10243
|
20 |
* The contents of this file are subject to the Openbravo Public License
|
ivan@10243
|
21 |
* Version 1.1 (the "License"), being the Mozilla Public License
|
ivan@10243
|
22 |
* Version 1.1 with a permitted attribution clause; you may not use this
|
ivan@10243
|
23 |
* file except in compliance with the License. You may obtain a copy of
|
ivan@10243
|
24 |
* the License at http://www.openbravo.com/legal/license.html
|
ivan@10243
|
25 |
* Software distributed under the License is distributed on an "AS IS"
|
ivan@10243
|
26 |
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
ivan@10243
|
27 |
* License for the specific language governing rights and limitations
|
ivan@10243
|
28 |
* under the License.
|
ivan@10243
|
29 |
* The Original Code is Openbravo ERP.
|
ivan@10243
|
30 |
* The Initial Developer of the Original Code is Openbravo SLU
|
david@26257
|
31 |
* All portions are Copyright (C) 2011-2015 Openbravo SLU
|
ivan@10243
|
32 |
* All Rights Reserved.
|
martin@15614
|
33 |
* Contributor(s): ______________________________________.
|
ivan@10243
|
34 |
************************************************************************
|
ivan@10243
|
35 |
*/
|
stefan@12524
|
36 |
|
stefan@12524
|
37 |
Logger log = Logger.getLogger(org.openbravo.authentication.AuthenticationManager.class);
|
ivan@10243
|
38 |
|
ivan@16780
|
39 |
AuthenticationManager authManager = AuthenticationManager.getAuthenticationManager(this);
|
ivan@10243
|
40 |
|
ivan@10243
|
41 |
String userId = authManager.authenticate(request, response);
|
ivan@16780
|
42 |
|
ivan@10243
|
43 |
if(userId == null){
|
ivan@10243
|
44 |
return;
|
ivan@10243
|
45 |
}
|
david@11337
|
46 |
|
david@16035
|
47 |
boolean uncompSC = false;
|
david@16039
|
48 |
String scDevModulePackage = "org.openbravo.userinterface.smartclient.dev";
|
david@16035
|
49 |
OBContext.setAdminMode();
|
david@16035
|
50 |
try {
|
david@16035
|
51 |
if (KernelUtils.getInstance().isModulePresent(scDevModulePackage)) {
|
david@16035
|
52 |
uncompSC = KernelUtils.getInstance().getModule(scDevModulePackage).isInDevelopment();
|
david@16035
|
53 |
}
|
david@16035
|
54 |
} catch (Exception e) {
|
david@16039
|
55 |
log.error("Error trying to acquire module \"" + scDevModulePackage + "\": " + e.getMessage(), e);
|
david@16035
|
56 |
} finally {
|
david@16035
|
57 |
OBContext.restorePreviousMode();
|
david@16035
|
58 |
}
|
david@16035
|
59 |
|
david@11337
|
60 |
String ua = request.getHeader( "User-Agent" );
|
david@11337
|
61 |
boolean isMSIE = ( ua != null && ua.indexOf( "MSIE" ) != -1 );
|
david@11337
|
62 |
int verMSIE = 0;
|
david@11337
|
63 |
String verMSIEtmp = "";
|
david@11337
|
64 |
if (isMSIE) {
|
david@11337
|
65 |
verMSIEtmp = ua.substring(ua.indexOf("MSIE") + 5);
|
david@11337
|
66 |
verMSIEtmp = verMSIEtmp.substring(0, verMSIEtmp.indexOf("."));
|
david@11337
|
67 |
if (ua.indexOf("MSIE 7.0") != -1 && ua.indexOf("Trident/4") != -1) {
|
david@11337
|
68 |
//In case IE8 runs in "IE8 Compatibility mode, look for Trident/4.0 to know that is IE8 although MSIE string is MSIE 7.0
|
david@11337
|
69 |
verMSIEtmp = "8";
|
david@11337
|
70 |
} else if (ua.indexOf("MSIE 7.0") != -1 && ua.indexOf("Trident/5") != -1) {
|
david@11337
|
71 |
// In case IE9 runs in "IE8 Compatibility mode, look for Trident/5.0 to know that is IE9 although MSIE string is MSIE 7.0
|
david@11337
|
72 |
verMSIEtmp = "9";
|
david@11337
|
73 |
} else if (ua.indexOf("MSIE 7.0") != -1 && ua.indexOf("Trident/") != -1) {
|
david@11337
|
74 |
// For hypothetic future IE versions in case IEX runs in "IEX Compatibility mode, look for Trident/ to know that is IEX although MSIE string is MSIE 7.0
|
david@11337
|
75 |
verMSIEtmp = "10"; //If this 'if' statement is not updated, could be 10 or 11 or anything... but set 10 just to ensure it is not in IE7
|
david@11337
|
76 |
}
|
david@11337
|
77 |
verMSIE = Integer.parseInt(verMSIEtmp);
|
david@11337
|
78 |
}
|
martin@15526
|
79 |
response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
martin@15526
|
80 |
response.addHeader("Pragma", "no-cache");
|
martin@15526
|
81 |
response.addHeader("Expires", "0");
|
ivan@10243
|
82 |
%>
|
david@16296
|
83 |
<!DOCTYPE html>
|
ivan@10243
|
84 |
|
david@16346
|
85 |
<html dir="<%=(OBContext.isRightToLeft() ? "RTL" : "LTR")%>">
|
david@10937
|
86 |
<head>
|
ivan@10243
|
87 |
<meta http-equiv="Expires" content="Tue, 24 Apr 1979 00:00:01 GMT"/>
|
ivan@10243
|
88 |
<meta http-equiv="Content-type" content="text/html;charset=utf-8"/>
|
martin@15525
|
89 |
<meta http-equiv="Cache-Control" content="no-cache no-store must-revalidate" >
|
ivan@10243
|
90 |
<meta http-equiv="Pragma" content="no-cache" >
|
david@26257
|
91 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
ivan@10243
|
92 |
<meta name="author" content="Openbravo S.L.U.">
|
ivan@10243
|
93 |
<meta name="keywords" content="openbravo">
|
ivan@10243
|
94 |
<meta name="description" content="Openbravo S.L.U.">
|
ivan@10256
|
95 |
<link rel="shortcut icon" href="./web/images/favicon.ico" />
|
ivan@16848
|
96 |
<link rel="stylesheet" type="text/css" href="./org.openbravo.client.kernel/OBCLKER_Kernel/StyleSheetResources?_appName=OB3&_skinVersion=Default&_cssDataUri=<%=(!isMSIE || (isMSIE && verMSIE >=8))%>"/>
|
david@11337
|
97 |
|
ivan@10243
|
98 |
<title>Openbravo</title>
|
ivan@16441
|
99 |
<script src="./web/org.openbravo.client.kernel/js/scopeleaks.min.js"></script>
|
ivan@16441
|
100 |
<script src="./web/org.openbravo.client.kernel/js/LAB.min.js"></script>
|
ivan@16441
|
101 |
<script src="./web/org.openbravo.client.kernel/js/BigDecimal-all-1.0.1.min.js"></script>
|
david@11337
|
102 |
|
david@23074
|
103 |
<script>
|
david@23074
|
104 |
(function () {
|
david@23074
|
105 |
var b = document.documentElement;
|
david@23074
|
106 |
b.setAttribute('data-useragent', navigator.userAgent);
|
david@23074
|
107 |
b.setAttribute('data-platform', navigator.platform );
|
david@23074
|
108 |
b.className += ((!!('ontouchstart' in window) || !!('onmsgesturechange' in window))?' touch':'');
|
david@23074
|
109 |
}());
|
david@23074
|
110 |
</script>
|
david@23074
|
111 |
|
ivan@10243
|
112 |
<!-- styles used during loading -->
|
ivan@16441
|
113 |
<style>
|
ivan@10243
|
114 |
html, body {
|
ivan@10243
|
115 |
height: 100%;
|
ivan@10243
|
116 |
width: 100%;
|
ivan@10243
|
117 |
}
|
ivan@10243
|
118 |
|
ivan@10243
|
119 |
.OBCenteredBox {
|
ivan@10243
|
120 |
position: fixed;
|
ivan@10243
|
121 |
z-index: 1000000;
|
ivan@10243
|
122 |
top: 50%;
|
ivan@10243
|
123 |
left: 50%;
|
ivan@10243
|
124 |
margin: -25px 0 0 -150px;
|
ivan@10243
|
125 |
width: 300px;
|
ivan@10243
|
126 |
height: 50px;
|
ivan@10243
|
127 |
}
|
ivan@10243
|
128 |
|
ivan@10243
|
129 |
.OBLoadingPromptLabel {
|
ivan@10243
|
130 |
font-family: 'Arial';
|
ivan@10243
|
131 |
font-size: 12px;
|
ivan@10243
|
132 |
color: #ccd0d4;
|
ivan@10243
|
133 |
}
|
ivan@10243
|
134 |
|
ivan@10243
|
135 |
.OBLoadingPromptModalMask {
|
ivan@10243
|
136 |
left: 0;
|
ivan@10243
|
137 |
top: 0;
|
ivan@10243
|
138 |
width: 100%;
|
ivan@10243
|
139 |
height: 100%;
|
ivan@10243
|
140 |
background-color: #7f7f7f;
|
ivan@10243
|
141 |
}
|
ivan@10243
|
142 |
</style>
|
ivan@10243
|
143 |
|
ivan@10243
|
144 |
</head>
|
david@16346
|
145 |
<body>
|
ivan@10243
|
146 |
|
ivan@10243
|
147 |
<!-- shows the loading div -->
|
ivan@10243
|
148 |
<div class="OBLoadingPromptModalMask" id="OBLoadingDiv">
|
ivan@10243
|
149 |
<div class="OBCenteredBox">
|
ivan@10243
|
150 |
<table>
|
ivan@10243
|
151 |
<tr>
|
ivan@10243
|
152 |
<td>
|
ivan@10243
|
153 |
<span class="OBLoadingPromptLabel">LOADING...</span>
|
ivan@10243
|
154 |
</td>
|
ivan@10243
|
155 |
<td>
|
martin@12927
|
156 |
<img width="220" height="16" src="./web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/images/system/windowLoading.gif"/>
|
ivan@10243
|
157 |
</td>
|
ivan@10243
|
158 |
</tr>
|
ivan@10243
|
159 |
</table>
|
ivan@10243
|
160 |
</div>
|
ivan@10243
|
161 |
</div>
|
ivan@10243
|
162 |
<!-- load the rest -->
|
ivan@16441
|
163 |
<script>
|
ivan@16848
|
164 |
// Bootstrap error handling: Shows an alert to the user when an error occurs loading static resources
|
ivan@16848
|
165 |
// This error handler gets removed at the end of static resources
|
ivan@16848
|
166 |
window.onerror = function <%=KernelConstants.BOOTSTRAP_ERROR_HANDLER_NAME%> (errorMsg, url, lineNumber) {
|
ivan@16848
|
167 |
var msg = errorMsg + ' - ' + url + ':' + lineNumber;
|
ivan@16848
|
168 |
document.body.removeChild(document.getElementById('OBLoadingDiv'));
|
ivan@16848
|
169 |
alert(msg);
|
ivan@16848
|
170 |
};
|
ivan@16848
|
171 |
|
martin@15579
|
172 |
$LAB.setGlobalDefaults({AppendTo: 'body'});
|
martin@15579
|
173 |
|
ivan@10243
|
174 |
var isomorphicDir='./web/org.openbravo.userinterface.smartclient/isomorphic/';
|
david@21907
|
175 |
var isc = window.isc ? window.isc : {};
|
ivan@10243
|
176 |
|
ivan@10243
|
177 |
// starts the application is called as the last statement in the StaticResources part
|
ivan@15702
|
178 |
function OBStartApplication() {
|
antonio@19359
|
179 |
<%
|
antonio@19359
|
180 |
//If the role has its access to the backend restricted, an error message will be shown
|
antonio@19359
|
181 |
final VariablesSecureApp vars1 = new VariablesSecureApp(request, false);
|
antonio@19368
|
182 |
OBContext.setAdminMode();
|
antonio@19368
|
183 |
try{
|
antonio@19368
|
184 |
String roleId=vars1.getRole();
|
antonio@19368
|
185 |
Role role;
|
antonio@19368
|
186 |
if(roleId==null || roleId.equals("")){
|
antonio@19368
|
187 |
role=OBDal.getInstance().get(User.class, userId).getDefaultRole();
|
antonio@19368
|
188 |
}else{
|
antonio@19368
|
189 |
role = OBDal.getInstance().get(Role.class, vars1.getRole());
|
antonio@19368
|
190 |
}
|
antonio@20499
|
191 |
if(role !=null && role.isRestrictbackend()){
|
antonio@19359
|
192 |
%>
|
antonio@19359
|
193 |
document.body.removeChild(document.getElementById('OBLoadingDiv'));
|
antonio@19359
|
194 |
isc.Dialog.create({message: OB.I18N.getLabel('OBUIAPP_RestrictedUser'), title: OB.I18N.getLabel('OBUIAPP_RestrictedUserTitle'), showCloseButton: false}).show();
|
antonio@19359
|
195 |
return;
|
antonio@19359
|
196 |
<%
|
antonio@19359
|
197 |
}
|
antonio@19368
|
198 |
}finally{
|
antonio@19368
|
199 |
OBContext.restorePreviousMode();
|
antonio@19368
|
200 |
}
|
antonio@19359
|
201 |
%>
|
martin@12947
|
202 |
OB.Layout.initialize();
|
ivan@10243
|
203 |
OB.Layout.draw();
|
ivan@10243
|
204 |
OB.Layout.ViewManager.createAddStartTab();
|
ivan@10243
|
205 |
// get rid of the loading stuff
|
ivan@10243
|
206 |
document.body.removeChild(document.getElementById('OBLoadingDiv'));
|
ivan@10243
|
207 |
OB.GlobalHiddenForm = document.forms.OBGlobalHiddenForm;
|
ivan@13342
|
208 |
<%
|
ivan@13342
|
209 |
if (session.getAttribute("STARTUP-MESSAGE") != null) {
|
ivan@13342
|
210 |
String text = (String) session.getAttribute("STARTUP-MESSAGE");
|
ivan@13342
|
211 |
String title = (String) session.getAttribute("STARTUP-MESSAGE-TITLE");
|
ivan@13342
|
212 |
session.removeAttribute("STARTUP-MESSAGE");
|
ivan@13342
|
213 |
session.removeAttribute("STARTUP-MESSAGE-TITLE");
|
ivan@13342
|
214 |
%>
|
ivan@13342
|
215 |
isc.say('<%=text%>', null, {title: '<%=title%>'});
|
ivan@13342
|
216 |
<%
|
ivan@13342
|
217 |
}
|
ivan@13342
|
218 |
%>
|
ivan@10243
|
219 |
}
|
ivan@10243
|
220 |
</script>
|
ivan@16441
|
221 |
<script src="./web/org.openbravo.userinterface.smartclient/isomorphic/ISC_Combined<%=(uncompSC ? ".uncompressed" : "")%>.js"></script>
|
ivan@16441
|
222 |
<script src="./web/org.openbravo.userinterface.smartclient/isomorphic/ISC_History<%=(uncompSC ? ".uncompressed" : "")%>.js"></script>
|
ivan@16848
|
223 |
<script src="./org.openbravo.client.kernel/OBCLKER_Kernel/StaticResources?_appName=OB3&_skinVersion=Default"></script>
|
ivan@11956
|
224 |
<iframe name="background_target" id="background_target" height="0" width="0" style="display:none;"></iframe>
|
antonio@11954
|
225 |
<form name="OBGlobalHiddenForm" method="post" action="blank.html" target="background_target">
|
antonio@11343
|
226 |
</form>
|
ivan@10243
|
227 |
</body>
|
ivan@14578
|
228 |
</html>
|