/
defaultLogin.jsp
293 lines (271 loc) · 11.5 KB
/
defaultLogin.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<%--
~ Copyright (C) 2000 - 2019 Silverpeas
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ As a special exception to the terms and conditions of version 3.0 of
~ the GPL, you may redistribute this Program in connection with Free/Libre
~ Open Source Software ("FLOSS") applications as described in Silverpeas's
~ FLOSS exception. You should have received a copy of the text describing
~ the FLOSS exception, and it is also available here:
~ "https://www.silverpeas.org/legal/floss_exception.html"
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--%>
<%@ page import="org.silverpeas.core.util.LocalizationBundle" %>
<%@ page import="org.silverpeas.core.util.StringUtil" %>
<%@ page import="org.silverpeas.core.web.util.DomainDetector" %>
<%@ page import="org.silverpeas.core.util.ResourceLocator" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.silverpeas.com/tld/viewGenerator" prefix="view" %>
<%@ taglib uri="http://www.silverpeas.com/tld/silverFunctions" prefix="silfn" %>
<fmt:setLocale value="${pageContext.request.locale.language}"/>
<%@ include file="headLog.jsp" %>
<c:set var="computedDomainId" value="<%= DomainDetector.getDomainId(request)%>"/>
<%
LocalizationBundle authenticationBundle = ResourceLocator.getLocalizationBundle(
"org.silverpeas.authentication.multilang.authentication",
request.getLocale().getLanguage());
pageContext.setAttribute("authenticationBundle", authenticationBundle);
String domainId = null;
if (StringUtil.isInteger(request.getParameter("DomainId"))) {
domainId = request.getParameter("DomainId");
request.setAttribute("Silverpeas_DomainId", domainId);
}
%>
<view:setBundle basename="org.silverpeas.authentication.multilang.authentication"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><fmt:message key="GML.popupTitle"/></title>
<link rel="icon" href="<%=favicon%>" />
<link type="text/css" rel="stylesheet" href="<%=styleSheet%>"/>
<view:includePlugin name="jquery"/>
<view:includePlugin name="tkn"/>
<script type="text/javascript">
// Public domain cookie code written by:
// Bill Dortch, hIdaho Design
// (bdortch@netw.com)
function getCookieVal(offset) {
var endstr = document.cookie.indexOf(";", offset);
if (endstr === -1) {
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie(name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) === arg)
return getCookieVal(j);
i = document.cookie.indexOf(" ", i) + 1;
if (i === 0) break;
}
return null;
}
function checkForm() {
$("form").submit();
}
function loginQuestion() {
var form = document.getElementById("formLogin");
if (form.elements["Login"].value.length === 0) {
alert('<fmt:message key="authentication.logon.loginMissing" />');
} else {
form.action = '<c:url value="/CredentialsServlet/LoginQuestion" />';
form.submit();
}
}
function resetPassword() {
var form = document.getElementById("formLogin");
if (form.elements["Login"].value.length === 0) {
alert('<fmt:message key="authentication.logon.loginMissing" />');
} else {
form.action = '<c:url value="/CredentialsServlet/ForgotPassword" />';
form.submit();
}
}
function changePassword() {
var form = document.getElementById("formLogin");
if (form.elements["Login"].value.length === 0) {
alert('<fmt:message key="authentication.logon.loginMissing" />');
} else {
form.action = '<c:url value="/CredentialsServlet/ChangePasswordFromLogin" />';
form.submit();
}
}
function newRegistration() {
var form = document.getElementById("formLogin");
form.action = '<c:url value="/CredentialsServlet/NewRegistration" />';
form.submit();
}
$(document).ready(function() {
$("#DomainId").on("keypress", function(event) {
if (event.keyCode === 13) {
checkForm();
}
});
});
</script>
<meta name="viewport" content="initial-scale=1.0"/>
</head>
<body>
<form id="formLogin" action="<c:url value="/AuthenticationServlet" />" method="post" accept-charset="UTF-8">
<% if (newRegistrationActive || facebookEnabled || linkedInEnabled) { %>
<div id="top">
<fmt:message key="authentication.logon.newRegistration.tease"/>
<% if (newRegistrationActive) { %>
<a href="javascript:newRegistration()"><fmt:message key="authentication.logon.newRegistration.create"/></a>
<% } %>
<% if (facebookEnabled || linkedInEnabled) {
if (newRegistrationActive) { %>
<fmt:message key="GML.or"/>
<% } %>
<fmt:message key="authentication.logon.newRegistration.connect"/>
<% if (linkedInEnabled) { %>
<a title="LinkedIn" href="<c:url value="/SocialNetworkLogin?networkId=LINKEDIN" />">LinkedIn</a>
<% } %>
<% if (facebookEnabled) { %>
<% if (linkedInEnabled) { %>
<fmt:message key="GML.or"/>
<% } %>
<a title="Facebook" href="<c:url value="/SocialNetworkLogin?networkId=FACEBOOK" />">Facebook</a>
<% } %>
<% } %>
</div>
<% } %>
<% if (facebookEnabled || linkedInEnabled) {%>
<div id="login-socialnetwork">
<% if (linkedInEnabled) { %>
<a title="<fmt:message key='authentication.logon.with.linkedin' />" href="<c:url value="/SocialNetworkLogin?networkId=LINKEDIN" />">
<img src="util/icons/external/btn-login-linkedin.png" alt=""/>
</a>
<% } %>
<% if (facebookEnabled) { %>
<a title="<fmt:message key='authentication.logon.with.facebook' />" href="<c:url value="/SocialNetworkLogin?networkId=FACEBOOK" />">
<img src="util/icons/external/btn-login-facebook.png" alt=""/>
</a>
<% } %>
</div>
<% } %>
<div class="page"> <!-- Centrage horizontal des elements (960px) -->
<div class="titre"><fmt:message key="authentication.logon.title"/></div>
<div id="background"> <!-- image de fond du formulaire -->
<div class="cadre">
<div id="header" style="display: table; width: 100%">
<div style="display: table-cell">
<img src="<%=logo%>" class="logo" alt="logo"/>
</div>
<div class="information" style="display: table-cell; width: 100%; text-align: right">
<c:set var="errorMessage"/>
<c:if test="${silfn:isDefined(param.ErrorCode) && '4' != param.ErrorCode}">
<fmt:message key="authentication.logon.${param.ErrorCode}" var="errorMessage"/>
</c:if>
<c:choose>
<c:when test="${silfn:isDefined(errorMessage) && !fn:startsWith(errorMessage, '???')}">
<span>${errorMessage}</span>
</c:when>
<c:otherwise>
<fmt:message key="authentication.logon.subtitle"/>
</c:otherwise>
</c:choose>
<c:if test="${not empty sessionScope.WarningMessage}">
<br/><span><c:out value="${sessionScope.WarningMessage}"/></span>
</c:if>
</div>
<div class="clear"></div>
</div>
<p>
<label><span><fmt:message key="authentication.logon.login"/></span><input type="text" name="Login" id="Login"/></label>
</p>
<p>
<label><span><fmt:message key="authentication.logon.password"/></span><input type="password" name="Password" id="Password" autocomplete="off"/></label>
</p>
<c:choose>
<c:when test="${!pageScope.multipleDomains}">
<input class="noDisplay" type="hidden" name="DomainId" value="<%=listDomains.get(0).getId()%>"/>
</c:when>
<c:when test="${not empty computedDomainId}">
<input class="noDisplay" type="hidden" name="DomainId" value="${computedDomainId}"/>
</c:when>
<c:otherwise>
<p><label><span><fmt:message key="authentication.logon.domain"/></span>
<select id="DomainId" name="DomainId" size="1">
<c:forEach var="domain" items="${pageScope.listDomains}">
<option value="<c:out value="${domain.id}" />"<c:if test="${domain.id eq param.DomainId}">selected</c:if>><c:out value="${domain.name}"/></option>
</c:forEach>
</select>
</label></p>
</c:otherwise>
</c:choose>
<p>
<input type="submit" style="width:0; height:0; border:0; padding:0"/>
<a href="#" class="<%=submitClass%>" onclick="checkForm()"><span><span>LOGIN</span></span></a>
</p>
<% if (forgottenPwdActive || changePwdFromLoginPageActive) { %>
<% if (forgottenPwdActive) { %>
<p>
<span class="forgottenPwd">
<% if ("personalQuestion".equalsIgnoreCase(pwdResetBehavior)) { %>
<a href="javascript:loginQuestion()"><fmt:message key="authentication.logon.passwordForgotten"/></a>
<% } else { %>
<a href="javascript:resetPassword()"><fmt:message key="authentication.logon.passwordReinit"/></a>
<%} %>
</span>
<% } %>
<% if (changePwdFromLoginPageActive) { %>
<% if (forgottenPwdActive) { %>
<span class="separator">|</span>
<span class="changePwd">
<% } else {%>
<p>
<span class="changePwd">
<% } %>
<a class="changePwd" href="javascript:changePassword()"><fmt:message key="authentication.logon.changePassword"/></a>
</span>
<% } %>
<% if (forgottenPwdActive || changePwdFromLoginPageActive) { %>
</p>
<% } %>
<% } %>
</div>
</div>
<div id="copyright"><fmt:message key="GML.trademark"/></div>
</div>
</form>
<!-- Fin class="page" -->
<script type="text/javascript">
var domainId = <%=domainId%>;
/* Si le domainId n'est pas dans la requete, alors recuperation depuis le cookie */
if (GetCookie("defaultDomain")) {
<% for (int i = 0 ; i < listDomains.size() && listDomains.size() > 1; i++) { %>
if (GetCookie("defaultDomain").toString() === "<%=(listDomains.get(i).getId())%>") {
document.getElementById("DomainId").options[<%=i%>].selected = true;
}
<% } %>
}
if (GetCookie("svpLogin")) {
document.getElementById("Login").value = GetCookie("svpLogin").toString();
}
document.getElementById("formLogin").Password.value = '';
document.getElementById("formLogin").Login.focus();
</script>
</body>
</html>