Commit d3c3b9e8 authored by Matt Tucker's avatar Matt Tucker Committed by matt

i18n fixes (JM-34 and JM-88).


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@749 b35dd754-fafc-0310-a699-88a17e54d16e
parent 787a8023
...@@ -86,10 +86,10 @@ public class UserManager { ...@@ -86,10 +86,10 @@ public class UserManager {
{ {
// Make sure that the username is valid. // Make sure that the username is valid.
try { try {
username = Stringprep.nameprep(username, true); username = Stringprep.nodeprep(username);
} }
catch (StringprepException se) { catch (StringprepException se) {
throw new IllegalArgumentException(se); throw new IllegalArgumentException("Invalid username: " + username, se);
} }
User user = provider.createUser(username, password, name, email); User user = provider.createUser(username, password, name, email);
userCache.put(username, user); userCache.put(username, user);
...@@ -105,10 +105,10 @@ public class UserManager { ...@@ -105,10 +105,10 @@ public class UserManager {
String username = user.getUsername(); String username = user.getUsername();
// Make sure that the username is valid. // Make sure that the username is valid.
try { try {
username = Stringprep.nameprep(username, true); username = Stringprep.nodeprep(username);
} }
catch (StringprepException se) { catch (StringprepException se) {
throw new IllegalArgumentException(se); throw new IllegalArgumentException("Invalid username: " + username, se);
} }
provider.deleteUser(user.getUsername()); provider.deleteUser(user.getUsername());
// Remove the user from cache. // Remove the user from cache.
...@@ -125,10 +125,10 @@ public class UserManager { ...@@ -125,10 +125,10 @@ public class UserManager {
public User getUser(String username) throws UserNotFoundException { public User getUser(String username) throws UserNotFoundException {
// Make sure that the username is valid. // Make sure that the username is valid.
try { try {
username = Stringprep.nameprep(username, true); username = Stringprep.nodeprep(username);
} }
catch (StringprepException se) { catch (StringprepException se) {
throw new IllegalArgumentException(se); throw new IllegalArgumentException("Invalid username: " + username, se);
} }
User user = (User) userCache.get(username); User user = (User) userCache.get(username);
if (user == null) { if (user == null) {
......
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.util;
import javax.servlet.*;
import java.io.IOException;
/**
* Sets the character encoding to UTF-8.
*
* @author Matt Tucker
*/
public class SetCharacterEncodingFilter implements Filter {
public void init(FilterConfig filterConfig) throws ServletException {
}
public void destroy() {
}
/**
* Sets the character encoding to be used for any content passing out of this filter.
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException
{
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=" + "UTF-8");
chain.doFilter(request, response);
}
}
...@@ -26,11 +26,21 @@ ...@@ -26,11 +26,21 @@
</init-param> </init-param>
</filter> </filter>
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>org.jivesoftware.util.SetCharacterEncodingFilter</filter-class>
</filter>
<filter-mapping> <filter-mapping>
<filter-name>AuthCheck</filter-name> <filter-name>AuthCheck</filter-name>
<url-pattern>*.jsp</url-pattern> <url-pattern>*.jsp</url-pattern>
</filter-mapping> </filter-mapping>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping> <filter-mapping>
<filter-name>AuthCheck</filter-name> <filter-name>AuthCheck</filter-name>
<servlet-name>PluginServlet</servlet-name> <servlet-name>PluginServlet</servlet-name>
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
org.jivesoftware.messenger.user.User, org.jivesoftware.messenger.user.User,
org.xmpp.packet.JID, org.xmpp.packet.JID,
org.xmpp.packet.Presence" org.xmpp.packet.Presence,
java.net.URLEncoder"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
// Handle a "message" click: // Handle a "message" click:
if (request.getParameter("message") != null) { if (request.getParameter("message") != null) {
response.sendRedirect("user-message.jsp?username=" + user.getUsername()); response.sendRedirect("user-message.jsp?username=" + URLEncoder.encode(user.getUsername(), "UTF-8"));
return; return;
} }
......
<%@ page import="org.jivesoftware.messenger.Session, <%@ page import="org.jivesoftware.messenger.Session,
org.xmpp.packet.Presence"%> org.xmpp.packet.Presence,
java.net.URLEncoder"%>
<%-- <%--
- $RCSfile$ - $RCSfile$
- $Revision$ - $Revision$
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
<td width="1%" nowrap><%= count %></td> <td width="1%" nowrap><%= count %></td>
<td width="10%" nowrap> <td width="10%" nowrap>
<% String name = sess.getAddress().getNode(); %> <% String name = sess.getAddress().getNode(); %>
<a href="session-details.jsp?jid=<%= sess.getAddress() %>" title="Click for more info..." <a href="session-details.jsp?jid=<%= URLEncoder.encode(sess.getAddress(), "UTF-8") %>" title="Click for more info..."
><%= ((name != null && !"".equals(name)) ? name : "<i>Anonymous</i>") %></a> ><%= ((name != null && !"".equals(name)) ? name : "<i>Anonymous</i>") %></a>
<% if (sess.getConnection().isSecure()) { %> <% if (sess.getConnection().isSecure()) { %>
...@@ -151,7 +152,7 @@ ...@@ -151,7 +152,7 @@
</td> </td>
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;"> <td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
<a href="session-summary.jsp?jid=<%= sess.getAddress() %>&close=true" <a href="session-summary.jsp?jid=<%= URLEncoder.encode(sess.getAddress(), "UTF-8") %>&close=true"
title="Click to kill session..." title="Click to kill session..."
onclick="return confirm('Are you sure you want to close this connection?');" onclick="return confirm('Are you sure you want to close this connection?');"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a> ><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
......
<%--
- $RCSfile$
- $Revision$
- $Date$
--%>
<%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.messenger.user.User,
java.util.*"
errorPage="error.jsp"
%>
<%@ include file="global.jsp" %>
<% // Get parameters
int start = ParamUtils.getIntParameter(request,"start",0);
int range = ParamUtils.getIntParameter(request,"range",10);
String formName = ParamUtils.getParameter(request,"formName");
String elName = ParamUtils.getParameter(request,"elName");
String panel = ParamUtils.getParameter(request,"panel");
if (panel == null) {
panel = "frameset";
}
%>
<% if ("frameset".equals(panel)) { %>
<html>
<title>User Browser</title>
<script language="JavaScript" type="text/javascript">
var users = new Array();
function getUserListDisplay() {
var display = "";
var sep = ", ";
for (var i=0; i<users.length; i++) {
if ((i+1) == users.length) {
sep = "";
}
display += (users[i] + sep);
}
return display;
}
function printUsers(theForm) {
theForm.users.value = getUserListDisplay();
}
function addUser(theForm, username) {
users[users.length] = username;
printUsers(theForm);
}
function closeWin() {
window.close();
}
function done() {
closeWin();
}
</script>
<frameset rows="*,105">
<frame name="main" src="user-browser.jsp?panel=main"
marginwidth="5" marginheight="5" scrolling="auto" frameborder="0">
<frame name="bottom" src="user-browser.jsp?panel=bottom&formName=<%= formName %>&elName=<%= elName %>"
marginwidth="5" marginheight="5" scrolling="no" frameborder="0">
</frameset>
</html>
<% } else if ("bottom".equals(panel)) { %>
<%@ include file="header.jsp" %>
<style type="text/css">
.mybutton {
width : 100%;
}
</style>
<form name="f" onsubmit="return false;">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td width="99%">
<textarea rows="4" cols="40" style="width:100%;" name="users" wrap="virtual"></textarea>
</td>
<td width="1%" nowrap>
<table cellpadding="0" cellspacing="0" border="0" width="75">
<tr>
<td>
<input type="submit" name="" value="Done" class="mybutton"
<%-- onclick="alert(parent.opener.document.f.action);parent.done();return false;"--%>
onclick="if(parent.getUserListDisplay()!=''){parent.opener.document.<%= formName %>.<%= elName %>.value=parent.getUserListDisplay();}parent.done();return false;">
</td>
</tr>
<tr>
<td>
<input type="submit" name="" value="Cancel" class="mybutton"
onclick="parent.closeWin();return false;">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<jsp:include page="bottom.jsp" flush="true" />
<% } else if ("main".equals(panel)) { %>
<% // Get the user manager
int userCount = userManager.getUserCount();
// paginator vars
int numPages = (int)Math.ceil((double)userCount/(double)range);
int curPage = (start/range) + 1;
%>
<%@ include file="header.jsp" %>
<% // Title of this page and breadcrumbs
String title = "User Browser";
String[][] breadcrumbs = {
{ "Home", "index.jsp" },
{ title, "user-browser.jsp" }
};
%>
<%@ include file="title-browser.jspf" %>
<p>
Total Users: <%= userManager.getUserCount() %>,
<% if (numPages > 1) { %>
Showing <%= (start+1) %>-<%= (start+range) %>,
<% } %>
Sorted by User ID. Click "Add User" to add a user to the list box below. When you're done
click "Done" or "Cancel".
</p>
<% if (numPages > 1) { %>
<p>
Pages:
[
<% for (int i=0; i<numPages; i++) {
String sep = ((i+1)<numPages) ? " " : "";
boolean isCurrent = (i+1) == curPage;
%>
<a href="user-browser.jsp?panel=main&start=<%= (i*range) %>"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (i+1) %></a><%= sep %>
<% } %>
]
</p>
<% } %>
<table class="box" cellpadding="3" cellspacing="1" border="0" width="100%">
<tr class="tableHeaderBlue">
<th>&nbsp;</th>
<th>Username</th>
<th>Name</th>
<th align="center">Add</th>
</tr>
<% // Print the list of users
Collection<User> users = userManager.getUsers(start, range);
if (users.isEmpty()) {
%>
<tr>
<td align="center" colspan="4">
No users in the system.
</td>
</tr>
<%
}
int i = start;
for (User user: users) {
i++;
%>
<tr class="jive-<%= (((i%2)==0) ? "even" : "odd") %>">
<td width="1%">
<%= i %>
</td>
<td width="60%">
<%= user.getUsername() %>
</td>
<td width="50%">
<%= user.getName() %>
</td>
<td width="1%" align="center">
<input type="submit" name="" value="Add User" class="jive-sm-button"
onclick="parent.addUser(parent.frames['bottom'].document.f,'<%= user.getUsername() %>');">
</td>
</tr>
<%
}
%>
</table>
</div>
<% if (numPages > 1) { %>
<p>
Pages:
[
<% for (i=0; i<numPages; i++) {
String sep = ((i+1)<numPages) ? " " : "";
boolean isCurrent = (i+1) == curPage;
%>
<a href="user-browser.jsp?panel=main&start=<%= (i*range) %>"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (i+1) %></a><%= sep %>
<% } %>
]
</p>
<% } %>
<jsp:include page="bottom.jsp" flush="true" />
<% } %>
<%--
- $RCSfile$
- $Revision$
- $Date$
--%>
<%@ page import="org.jivesoftware.util.*,
java.util.HashMap,
java.util.Map,
org.jivesoftware.messenger.user.*,
org.jivesoftware.messenger.user.UserAlreadyExistsException"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%-- Define Administration Bean --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %>
<% // Get parameters
String username = ParamUtils.getParameter(request,"username");
// Load user object
User user = admin.getUserManager().getUser(username);
// Handle button clicks:
if (request.getParameter("details") != null) {
response.sendRedirect("user-properties.jsp?username=" + username);
return;
}
if (request.getParameter("new") != null) {
response.sendRedirect("user-create.jsp");
return;
}
%>
<!-- Define BreadCrumbs -->
<fmt:message key="title" var="t" />
<c:set var="title" value="${t} Admin" />
<c:set var="breadcrumbs" value="${admin.breadCrumbs}" />
<c:set target="${breadcrumbs}" property="Home" value="index.jsp" />
<c:set target="${breadcrumbs}" property="${title}" value="user-create.jsp" />
<jsp:include page="top.jsp" flush="true" />
<p>
User created successfully!
</p>
<form action="user-create-success.jsp">
<input type="hidden" name="username" value="<%= username %>">
<center>
<input type="submit" name="details" value="Go to User Details">
<input type="submit" name="new" value="Create Another User">
</center>
</form>
<jsp:include page="bottom.jsp" flush="true" />
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
java.io.PrintStream, java.io.PrintStream,
org.dom4j.xpath.DefaultXPath, org.dom4j.xpath.DefaultXPath,
org.dom4j.*" org.dom4j.*,
java.net.URLEncoder"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -75,7 +76,8 @@ ...@@ -75,7 +76,8 @@
response.sendRedirect("user-create.jsp?success=true"); response.sendRedirect("user-create.jsp?success=true");
} }
else { else {
response.sendRedirect("user-properties.jsp?success=true&username=" + newUser.getUsername()); response.sendRedirect("user-properties.jsp?success=true&username=" +
URLEncoder.encode(newUser.getUsername(), "UTF-8"));
} }
return; return;
} }
...@@ -83,7 +85,6 @@ ...@@ -83,7 +85,6 @@
errors.put("usernameAlreadyExists",""); errors.put("usernameAlreadyExists","");
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace();
errors.put("general",""); errors.put("general","");
Log.error(e); Log.error(e);
} }
...@@ -155,7 +156,7 @@ ...@@ -155,7 +156,7 @@
<% } %> <% } %>
<form name="f" action="user-create.jsp" method="post"> <form name="f" action="user-create.jsp" method="get">
<fieldset> <fieldset>
<legend>Create New User</legend> <legend>Create New User</legend>
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
<%@ page import="org.jivesoftware.util.*, <%@ page import="org.jivesoftware.util.*,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*,
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
org.xmpp.packet.JID" org.xmpp.packet.JID,
java.net.URLEncoder"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
// Handle a cancel // Handle a cancel
if (cancel) { if (cancel) {
response.sendRedirect("user-properties.jsp?username=" + username); response.sendRedirect("user-properties.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
...@@ -60,16 +61,17 @@ ...@@ -60,16 +61,17 @@
String title = "Delete User"; String title = "Delete User";
pageinfo.setTitle(title); pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp")); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "user-delete.jsp?username="+username)); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title,
"user-delete.jsp?username="+URLEncoder.encode(username, "UTF-8")));
pageinfo.setSubPageID("user-delete"); pageinfo.setSubPageID("user-delete");
pageinfo.setExtraParams("username="+username); pageinfo.setExtraParams("username="+URLEncoder.encode(username, "UTF-8"));
%> %>
<jsp:include page="top.jsp" flush="true" /> <jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" /> <jsp:include page="title.jsp" flush="true" />
<p> <p>
Are you sure you want to delete the user Are you sure you want to delete the user
<b><a href="user-properties.jsp?username=<%= user.getUsername() %>"><%= user.getUsername() %></a></b> <b><a href="user-properties.jsp?username=<%= URLEncoder.encode(user.getUsername(), "UTF-8") %>"><%= user.getUsername() %></a></b>
from the system? from the system?
</p> </p>
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
java.text.DateFormat, java.text.DateFormat,
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
java.util.HashMap, java.util.HashMap,
java.util.Map" java.util.Map,
java.net.URLEncoder"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -32,7 +33,7 @@ ...@@ -32,7 +33,7 @@
// Handle a cancel // Handle a cancel
if (request.getParameter("cancel") != null) { if (request.getParameter("cancel") != null) {
response.sendRedirect("user-properties.jsp?username=" + username); response.sendRedirect("user-properties.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
...@@ -54,7 +55,7 @@ ...@@ -54,7 +55,7 @@
user.setName(name); user.setName(name);
// Changes good, so redirect // Changes good, so redirect
response.sendRedirect("user-properties.jsp?editsuccess=true&username=" + username); response.sendRedirect("user-properties.jsp?editsuccess=true&username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
} }
...@@ -65,9 +66,10 @@ ...@@ -65,9 +66,10 @@
String title = "Edit User"; String title = "Edit User";
pageinfo.setTitle(title); pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp")); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "user-edit-form.jsp?username="+username)); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title,
"user-edit-form.jsp?username="+URLEncoder.encode(username, "UTF-8")));
pageinfo.setSubPageID("user-properties"); pageinfo.setSubPageID("user-properties");
pageinfo.setExtraParams("username="+username); pageinfo.setExtraParams("username="+URLEncoder.encode(username, "UTF-8"));
%> %>
<jsp:include page="top.jsp" flush="true" /> <jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" /> <jsp:include page="title.jsp" flush="true" />
......
<%--
- $RCSfile$
- $Revision$
- $Date$
--%>
<%@ page import="org.jivesoftware.util.*,
org.jivesoftware.messenger.user.UserManager,
java.text.DateFormat,
org.jivesoftware.messenger.user.User"
errorPage="error.jsp"
%>
<%@ include file="global.jsp" %>
<% // Get parameters //
boolean cancel = request.getParameter("cancel") != null;
String username = ParamUtils.getParameter(request,"username");
// Handle a cancel
if (cancel) {
response.sendRedirect("user-edit-form.jsp?username=" + username);
return;
}
// Load the user object
User user = userManager.getUser(username);
%>
<jsp:include page="header.jsp" flush="true" />
<% // Title of this page and breadcrumbs
String title = "Email User";
String[][] breadcrumbs = {
{ "Home", "index.jsp" },
{ "User Summary", "user-summary.jsp" },
{ "Edit User", "user-edit-form.jsp?username="+username },
{ title, "user-email.jsp?username="+username }
};
%>
<jsp:include page="title.jsp" flush="true" />
<p>
Use the form below to send an email to the user.
</p>
<form action="user-email.jsp" name="emailform">
<input type="hidden" name="username" value="<%= username %>">
<div class="jive-table">
<table cellpadding="3" cellspacing="1" border="0" width="100%">
<tr>
<th colspan="2">
Email Message
</th>
</tr>
<tr>
<td class="jive-label">
From:
</td>
<td>
<%= pageUser.getUsername() %> &lt;<%= pageUser.getEmail() %>&gt;
(<a href="user-edit-form.jsp?username=<%= user.getUsername() %>">Edit User</a>)
</td>
</tr>
<tr>
<td class="jive-label">
TO:
</td>
<td>
<input type="text" name="to" value="<%= user.getUsername() %> &lt;<%= user.getEmail() %>&gt;"
size="45" maxlength="150">
</td>
</tr>
<tr>
<td class="jive-label">
CC:
</td>
<td>
<input type="text" name="cc" value="" size="45" maxlength="150">
</td>
</tr>
<tr>
<td class="jive-label">
Subject:
</td>
<td>
<input type="text" name="subject" value="" size="55" maxlength="150" style="width:100%">
</td>
</tr>
<tr>
<td class="jive-label" valign="top">
Message:
</td>
<td>
<textarea name="body" cols="50" rows="7" wrap="virtual" style="width:100%"></textarea>
</td>
</tr>
</table>
</div>
<br>
<input type="submit" value="Send!" name="send" onclick="alert('Not implemented yet');return false;">
<input type="submit" value="Cancel" name="cancel">
</form>
<script lang="JavaScript" type="text/javascript">
document.emailform.subject.focus();
</script>
<jsp:include page="footer.jsp" flush="true" />
\ No newline at end of file
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
java.util.HashMap, java.util.HashMap,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*,
java.util.Map, java.util.Map,
org.xmpp.packet.JID" org.xmpp.packet.JID,
java.net.URLEncoder"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -47,7 +48,7 @@ ...@@ -47,7 +48,7 @@
return; return;
} }
else { else {
response.sendRedirect("user-properties.jsp?username=" + username); response.sendRedirect("user-properties.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
} }
...@@ -92,7 +93,8 @@ ...@@ -92,7 +93,8 @@
} }
} }
if (username != null){ if (username != null){
response.sendRedirect("user-message.jsp?success=true&username=" + username + "&tabs=" + tabs); response.sendRedirect("user-message.jsp?success=true&username=" +
URLEncoder.encode(username, "UTF-8") + "&tabs=" + tabs);
} }
else { else {
response.sendRedirect("user-message.jsp?success=true"); response.sendRedirect("user-message.jsp?success=true");
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
java.text.DateFormat, java.text.DateFormat,
org.jivesoftware.messenger.auth.AuthFactory, org.jivesoftware.messenger.auth.AuthFactory,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*,
org.jivesoftware.admin.AdminPageBean" org.jivesoftware.admin.AdminPageBean,
java.net.URLEncoder"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
// Handle a cancel // Handle a cancel
if (cancel) { if (cancel) {
response.sendRedirect("user-properties.jsp?username=" + username); response.sendRedirect("user-properties.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
if (password != null && passwordConfirm != null && password.equals(passwordConfirm)) { if (password != null && passwordConfirm != null && password.equals(passwordConfirm)) {
user.setPassword(password); user.setPassword(password);
// Done, so redirect // Done, so redirect
response.sendRedirect("user-password.jsp?success=true&username=" + username); response.sendRedirect("user-password.jsp?success=true&username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
else { else {
...@@ -59,9 +60,10 @@ ...@@ -59,9 +60,10 @@
String title = "Change Password"; String title = "Change Password";
pageinfo.setTitle(title); pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp")); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "user-password.jsp?username="+username)); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title,
"user-password.jsp?username="+URLEncoder.encode(username, "UTF-8")));
pageinfo.setSubPageID("user-password"); pageinfo.setSubPageID("user-password");
pageinfo.setExtraParams("username="+username); pageinfo.setExtraParams("username="+URLEncoder.encode(username, "UTF-8"));
%> %>
<jsp:include page="top.jsp" flush="true" /> <jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" /> <jsp:include page="title.jsp" flush="true" />
...@@ -107,14 +109,6 @@ Use the form below to change the user's password. ...@@ -107,14 +109,6 @@ Use the form below to change the user's password.
<div> <div>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody> <tbody>
<tr>
<td class="c1">
User ID:
</td>
<td class="c2">
<%= user.getUsername() %>
</td>
</tr>
<tr> <tr>
<td class="c1"> <td class="c1">
Username: Username:
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
java.util.*, java.util.*,
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
org.jivesoftware.messenger.*, org.jivesoftware.messenger.*,
org.xmpp.packet.Presence" org.xmpp.packet.Presence,
java.net.URLEncoder"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
...@@ -38,19 +39,13 @@ ...@@ -38,19 +39,13 @@
// Handle a delete // Handle a delete
if (delete) { if (delete) {
response.sendRedirect("user-delete.jsp?username=" + username); response.sendRedirect("user-delete.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
// Handle an email // Handle password change
if (email) {
response.sendRedirect("user-email.jsp?username=" + username);
return;
}
// Handle an email
if (password) { if (password) {
response.sendRedirect("user-password.jsp?username=" + username); response.sendRedirect("user-password.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return; return;
} }
...@@ -74,9 +69,10 @@ ...@@ -74,9 +69,10 @@
String title = "User Properties"; String title = "User Properties";
pageinfo.setTitle(title); pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp")); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "user-properties.jsp?username="+username)); pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title,
"user-properties.jsp?username="+URLEncoder.encode(username, "UTF-8")));
pageinfo.setSubPageID("user-properties"); pageinfo.setSubPageID("user-properties");
pageinfo.setExtraParams("username="+username); pageinfo.setExtraParams("username="+URLEncoder.encode(username, "UTF-8"));
%> %>
<jsp:include page="top.jsp" flush="true" /> <jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" /> <jsp:include page="title.jsp" flush="true" />
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*,
java.util.HashMap, java.util.HashMap,
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
java.util.Map" java.util.Map,
java.net.URLEncoder"
%> %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
...@@ -39,7 +40,8 @@ ...@@ -39,7 +40,8 @@
} }
if (user != null) { if (user != null) {
// found the user, so redirect to the user properties page: // found the user, so redirect to the user properties page:
response.sendRedirect("user-properties.jsp?username=" + user.getUsername()); response.sendRedirect("user-properties.jsp?username=" +
URLEncoder.encode(user.getUsername(), "UTF-8"));
return; return;
} }
} }
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
java.text.DateFormat, java.text.DateFormat,
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
org.jivesoftware.messenger.PresenceManager, org.jivesoftware.messenger.PresenceManager,
org.xmpp.packet.Presence" org.xmpp.packet.Presence,
java.net.URLEncoder"
%> %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
...@@ -163,7 +164,7 @@ Sorted by Username ...@@ -163,7 +164,7 @@ Sorted by Username
<% } %> <% } %>
</td> </td>
<td width="30%"> <td width="30%">
<a href="user-properties.jsp?username=<%= user.getUsername() %>"><%= user.getUsername() %></a> <a href="user-properties.jsp?username=<%= URLEncoder.encode(user.getUsername(), "UTF-8") %>"><%= user.getUsername() %></a>
</td> </td>
<td width="40%"> <td width="40%">
<%= user.getName() %> &nbsp; <%= user.getName() %> &nbsp;
...@@ -172,12 +173,12 @@ Sorted by Username ...@@ -172,12 +173,12 @@ Sorted by Username
<%= dateFormatter.format(user.getCreationDate()) %> <%= dateFormatter.format(user.getCreationDate()) %>
</td> </td>
<td width="1%" align="center"> <td width="1%" align="center">
<a href="user-edit-form.jsp?username=<%= user.getUsername() %>" <a href="user-edit-form.jsp?username=<%= URLEncoder.encode(user.getUsername(), "UTF-8") %>"
title="Click to edit..." title="Click to edit..."
><img src="images/edit-16x16.gif" width="17" height="17" border="0"></a> ><img src="images/edit-16x16.gif" width="17" height="17" border="0"></a>
</td> </td>
<td width="1%" align="center" style="border-right:1px #ccc solid;"> <td width="1%" align="center" style="border-right:1px #ccc solid;">
<a href="user-delete.jsp?username=<%= user.getUsername() %>" <a href="user-delete.jsp?username=<%= URLEncoder.encode(user.getUsername(), "UTF-8") %>"
title="Click to delete..." title="Click to delete..."
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a> ><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td> </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