Commit 124bdfef authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Added test page for verifying adminitrators when using LDAP. JM-870

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5732 b35dd754-fafc-0310-a699-88a17e54d16e
parent 40bb3dba
......@@ -133,7 +133,15 @@
## Added key: 'global.hours'
## Added key: 'global.day'
## Added key: 'global.days'
## Added key: 'global.test'
## Added key: 'global.click_test'
## Added key: 'user.summary.last-logout'
## Added key: 'setup.admin.settings.test.title-desc'
## Added key: 'setup.admin.settings.test.status-success'
## Added key: 'setup.admin.settings.test.status-success.detail'
## Added key: 'setup.admin.settings.test.status-error'
## Added key: 'setup.admin.settings.test.error-user'
## Added key: 'setup.admin.settings.test.error-password'
# Wildfire
......@@ -439,6 +447,8 @@ global.click_delete=Click to delete...
global.yes=Yes
global.no=No
global.unlimited=Unlimited
global.test=Test
global.click_test=Click to test...
# Group Chat Service Properties Page
......@@ -1292,6 +1302,14 @@ setup.admin.settings.add.administrator = Add Administrator
setup.admin.settings.administrator = Administrator
setup.admin.settings.remove = Remove
setup.admin.settings.test.title-desc=Administrator Settings
setup.admin.settings.test.status-success=Status: Authentication Successful!
setup.admin.settings.test.status-success.detail=Specified username and password are valid. Close \
this test panel to continue.
setup.admin.settings.test.status-error=Status: Authentication Failed
setup.admin.settings.test.error-user=Username not found.
setup.admin.settings.test.error-password=Password is incorrect.
# Setup completed Page
setup.completed.setup=Setup
......
......@@ -307,6 +307,8 @@ global.click_delete=Presione para borrar...
global.yes=Si
global.no=No
global.unlimited=Ilimitado
global.test=Testear
global.click_test=Clic para verificar...
# Group Chat Service Properties Page
......@@ -1081,6 +1083,14 @@ setup.admin.settings.add.administrator = Agregar Administrador
setup.admin.settings.administrator = Administrador
setup.admin.settings.remove = Eliminar
setup.admin.settings.test.title-desc=Seteos de Administrador
setup.admin.settings.test.status-success=Estatus: Autenticaci\u00f3n Exitosa!
setup.admin.settings.test.status-success.detail=Nombre de usuario y clave especificadas son correctas. Cierre \
este panel de control para continuar.
setup.admin.settings.test.status-error=Estatus: Autenticaci\u00f3n ha Fallado
setup.admin.settings.test.error-user=Nombre de usuario no encontrado.
setup.admin.settings.test.error-password=Clave es incorrecta.
# Setup completed Page
setup.completed.setup=Configuraci\u00f3n
......
......@@ -10,6 +10,7 @@
<excludes>
<pattern>/setup/setup-completed.jsp*</pattern>
<pattern>/setup/setup-ldap-server_test.jsp*</pattern>
<pattern>/setup/setup-admin-settings_test.jsp*</pattern>
<pattern>/login.jsp*</pattern>
<pattern>/plugin-icon.jsp*</pattern>
<pattern>/js/jscalendar/i18n.jsp*</pattern>
......
......@@ -13,6 +13,7 @@
org.jivesoftware.wildfire.user.UserManager" %>
<%@ page import="javax.servlet.http.HttpSession"%>
<%@ page import="java.util.*"%>
<%@ page import="java.net.URLEncoder" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
......@@ -33,6 +34,7 @@
<%
// Get parameters
String username = ParamUtils.getParameter(request,"username");
String password = ParamUtils.getParameter(request,"password");
String email = ParamUtils.getParameter(request,"email");
String newPassword = ParamUtils.getParameter(request,"newPassword");
......@@ -40,6 +42,7 @@
boolean doContinue = request.getParameter("continue") != null;
boolean doSkip = request.getParameter("doSkip") != null;
boolean doTest = request.getParameter("test") != null;
boolean ldap = "true".equals(request.getParameter("ldap"));
......@@ -148,7 +151,7 @@
// This handles the case of reverting back to default settings from LDAP. Will
// add admin to the authorizedUsername list if the authorizedUsername list contains
// entries.
if(!ldap){
if(!ldap && !doTest){
String currentAdminList = JiveGlobals.getXMLProperty("admin.authorizedUsernames");
List<String> adminCollection = new ArrayList<String>(StringUtils.stringToCollection(currentAdminList));
if((!adminCollection.isEmpty() && !adminCollection.contains("admin")) || JiveGlobals.getXMLProperty("admin.authorizedJIDs") != null){
......@@ -338,6 +341,25 @@ document.acctform.newPassword.focus();
<% } else { %>
<% if (doTest) {
StringBuffer testLink = new StringBuffer();
testLink.append("setup-admin-settings_test.jsp?username=");
testLink.append(URLEncoder.encode(username, "UTF-8"));
if (password != null) {
testLink.append("&password=").append(URLEncoder.encode(password, "UTF-8"));
}
%>
<a href="<%= testLink %>" id="lbmessage" title="<fmt:message key="global.test" />" style="display:none;"></a>
<script type="text/javascript">
function loadMsg() {
var lb = new lightbox(document.getElementById('lbmessage'));
lb.activate();
}
setTimeout('loadMsg()', 250);
</script>
<% } %>
<p>
<fmt:message key="setup.admin.settings.ldap.info" />
</p>
......@@ -369,17 +391,23 @@ document.acctform.newPassword.focus();
<table class="jive-vcardTable" cellpadding="3" cellspacing="0" border="0">
<tr>
<th nowrap><fmt:message key="setup.admin.settings.administrator" /></th>
<th width="1%" nowrap><fmt:message key="global.test" /></th>
<th width="1%" nowrap><fmt:message key="setup.admin.settings.remove" /></th>
</tr>
<%
for (String username : StringUtils.stringToCollection(authorizedUsernames)) {
for (String authUsername : StringUtils.stringToCollection(authorizedUsernames)) {
%>
<tr valign="top">
<td>
<%= username%>
<%= authUsername%>
</td>
<td width="1%" align="center">
<a href="setup-admin-settings.jsp?ldap=true&test=true&username=<%= URLEncoder.encode(authUsername, "UTF-8") %>"
title="<fmt:message key="global.click_test" />"
><img src="../images/setup_btn_gearplay.gif" width="14" height="14" border="0" alt="<fmt:message key="global.click_test" />"></a>
</td>
<td>
<input type="checkbox" name="remove" value="<%=username%>"/>
<input type="checkbox" name="remove" value="<%=authUsername%>"/>
</td>
</tr>
......@@ -391,6 +419,9 @@ document.acctform.newPassword.focus();
<td>
&nbsp;
</td>
<td>
&nbsp;
</td>
<td>
<input type="submit" name="deleteAdmins" value="Remove"/>
</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment