From 53adb8ae38bbe3d283ba5797ffb882c3b81c5d11 Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Mon, 17 Jul 2023 14:34:35 +0200 Subject: [PATCH] OF-2627: Correctly URL-escape group names in admin console This prevents issues with working with group names that have URL-escaped characters in their name (like the `+` character). --- xmppserver/src/main/webapp/group-create.jsp | 187 +++++++++---------- xmppserver/src/main/webapp/group-delete.jsp | 8 +- xmppserver/src/main/webapp/group-edit.jsp | 2 +- xmppserver/src/main/webapp/group-summary.jsp | 10 +- 4 files changed, 97 insertions(+), 110 deletions(-) diff --git a/xmppserver/src/main/webapp/group-create.jsp b/xmppserver/src/main/webapp/group-create.jsp index 3ee8159fa6..4133a92d60 100644 --- a/xmppserver/src/main/webapp/group-create.jsp +++ b/xmppserver/src/main/webapp/group-create.jsp @@ -132,83 +132,75 @@ } } } + + pageContext.setAttribute("groupName", groupName); + if (groupName != null) { + pageContext.setAttribute("group", webManager.getGroupManager().getGroup(groupName)); + } + pageContext.setAttribute( "errors", errors ); + pageContext.setAttribute( "name", name ); + pageContext.setAttribute( "description", description ); %> -<% - // If editing the group. - if (groupName != null) { - %> - <fmt:message key="group.edit.title" /> - <% } - // Otherwise creating a new group. - else { - %> - <fmt:message key="group.create.title" /> - <% } %> - - -<% if (groupName == null) { %> - -<% } - else { %> - -"/> -<% } %> - - + + + <fmt:message key="group.edit.title" /> + + + + <fmt:message key="group.create.title" /> + + + + + -<% if (errors.get("general") != null) { %> - - - -<% } %> + + + + + -<% if (webManager.getGroupManager().isReadOnly()) { %> -
- -
-<% } %> + +
+ +
+

- <% - // If editing the group. - if (groupName != null) { - %> - - <% } - // Otherwise creating a new group. - else { - %> - - <% } %> + + + + + + + +

- <% if (groupName != null) { %> - - <% } %> + + " id="existingName"> +
- <% - // If editing the group. - if (groupName != null) { - %> - - <% } - // Otherwise creating a new group. - else { - %> - - <% } %> + + + + + + + +
@@ -217,63 +209,56 @@ * - <% if (errors.get("name") != null || errors.get("groupAlreadyExists") != null) { %> - + - - <% } %> + + + + + + + - <% if (errors.get("description") != null) { %> - + - + - - <% } %> + @@ -288,19 +273,17 @@ document.f.name.focus(); -<% // Disable the form if a read-only user provider. -if (webManager.getGroupManager().isReadOnly()) { %> - - -<% } %> + + + -%> + diff --git a/xmppserver/src/main/webapp/group-delete.jsp b/xmppserver/src/main/webapp/group-delete.jsp index cccda987d3..352af5fb00 100644 --- a/xmppserver/src/main/webapp/group-delete.jsp +++ b/xmppserver/src/main/webapp/group-delete.jsp @@ -23,6 +23,7 @@ %> <%@ page import="org.jivesoftware.openfire.security.SecurityAuditManager" %> +<%@ taglib uri="admin" prefix="admin" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> @@ -66,13 +67,14 @@ response.sendRedirect("group-summary.jsp?deletesuccess=true"); return; } + pageContext.setAttribute( "group", group ); %> <fmt:message key="group.delete.title"/> - "/> + @@ -85,13 +87,13 @@

-"><%= group.getName() %> +

- +"> "> "> diff --git a/xmppserver/src/main/webapp/group-edit.jsp b/xmppserver/src/main/webapp/group-edit.jsp index ffa2069cba..7410ae6908 100644 --- a/xmppserver/src/main/webapp/group-edit.jsp +++ b/xmppserver/src/main/webapp/group-edit.jsp @@ -345,7 +345,7 @@ <fmt:message key="group.edit.title"/> - + diff --git a/xmppserver/src/main/webapp/group-summary.jsp b/xmppserver/src/main/webapp/group-summary.jsp index facb6a72ce..6304b4ef5b 100644 --- a/xmppserver/src/main/webapp/group-summary.jsp +++ b/xmppserver/src/main/webapp/group-summary.jsp @@ -26,8 +26,10 @@ <%@ page import="org.jivesoftware.util.ListPager" %> <%@ page import="org.jivesoftware.util.ParamUtils" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> +<%@ taglib uri="admin" prefix="admin" %> <% webManager.init(request, response, session, application, out ); %> @@ -148,7 +150,7 @@ @@ -156,13 +158,13 @@
- " id="gname"> + " id="gname">
  - <% if (errors.get("name") != null) { %> - - <% } else if (errors.get("groupAlreadyExists") != null) { %> - - <% } %> +
  + +
- +
-   -  
- <% - // If editing the group. - if (groupName != null) { - %> - "> - <% } - // Otherwise creating a new group. - else { - %> - "> - <% } %> + + + "> + + + "> + + ">
- " + - " + <fmt:message key="global.click_edit"/> - " + <fmt:message key="global.click_delete" />