Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
34971f95
Commit
34971f95
authored
Jun 30, 2017
by
daryl herzmann
Committed by
GitHub
Jun 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #830 from guusdk/OF-1350_MUC-password
OF-1350 MUC passwords
parents
b3941322
5bdb2b80
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
33 deletions
+69
-33
openfire_i18n_en.properties
src/i18n/openfire_i18n_en.properties
+1
-1
IQOwnerHandler.java
...ava/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java
+52
-20
LocalMUCUser.java
src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java
+3
-0
muc-room-edit-form.jsp
src/web/muc-room-edit-form.jsp
+13
-12
No files found.
src/i18n/openfire_i18n_en.properties
View file @
34971f95
...
...
@@ -1252,7 +1252,7 @@ muc.room.edit.form.reservednick=Only login with registered nickname
muc.room.edit.form.canchangenick
=
Allow Occupants to change nicknames
muc.room.edit.form.registration
=
Allow Users to register with the room
muc.room.edit.form.log
=
Log Room Conversations
muc.room.edit.form.required_field
=
Required Field
# Muc room summary Page
muc.room.summary.title
=
Group Chat Rooms
...
...
src/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java
View file @
34971f95
...
...
@@ -28,10 +28,7 @@ import org.jivesoftware.openfire.group.Group;
import
org.jivesoftware.openfire.group.GroupJID
;
import
org.jivesoftware.openfire.group.GroupManager
;
import
org.jivesoftware.openfire.group.GroupNotFoundException
;
import
org.jivesoftware.openfire.muc.CannotBeInvitedException
;
import
org.jivesoftware.openfire.muc.ConflictException
;
import
org.jivesoftware.openfire.muc.ForbiddenException
;
import
org.jivesoftware.openfire.muc.MUCRole
;
import
org.jivesoftware.openfire.muc.*
;
import
org.jivesoftware.openfire.muc.cluster.RoomUpdatedEvent
;
import
org.jivesoftware.util.JiveGlobals
;
import
org.jivesoftware.util.LocaleUtils
;
...
...
@@ -95,7 +92,8 @@ public class IQOwnerHandler {
* @throws ConflictException If the room was going to lose all of its owners.
*/
@SuppressWarnings
(
"unchecked"
)
public
void
handleIQ
(
IQ
packet
,
MUCRole
role
)
throws
ForbiddenException
,
ConflictException
,
CannotBeInvitedException
{
public
void
handleIQ
(
IQ
packet
,
MUCRole
role
)
throws
ForbiddenException
,
ConflictException
,
CannotBeInvitedException
,
NotAcceptableException
{
// Only owners can send packets with the namespace "http://jabber.org/protocol/muc#owner"
if
(
MUCRole
.
Affiliation
.
owner
!=
role
.
getAffiliation
())
{
throw
new
ForbiddenException
();
...
...
@@ -158,7 +156,7 @@ public class IQOwnerHandler {
* @throws ConflictException If the room was going to lose all of its owners.
*/
private
void
handleDataFormElement
(
MUCRole
senderRole
,
Element
formElement
)
throws
ForbiddenException
,
ConflictException
{
throws
ForbiddenException
,
ConflictException
,
NotAcceptableException
{
DataForm
completedForm
=
new
DataForm
(
formElement
);
switch
(
completedForm
.
getType
())
{
...
...
@@ -206,7 +204,8 @@ public class IQOwnerHandler {
* @throws ConflictException If the room was going to lose all of its owners.
*/
private
void
processConfigurationForm
(
DataForm
completedForm
,
MUCRole
senderRole
)
throws
ForbiddenException
,
ConflictException
{
throws
ForbiddenException
,
ConflictException
,
NotAcceptableException
{
List
<
String
>
values
;
String
booleanValue
;
FormField
field
;
...
...
@@ -320,23 +319,56 @@ public class IQOwnerHandler {
room
.
setCanOccupantsInvite
((
"1"
.
equals
(
booleanValue
)));
}
boolean
passwordProtectionChanged
=
false
;
boolean
passwordChanged
=
false
;
boolean
updatedIsPasswordProtected
=
false
;
String
updatedPassword
=
null
;
field
=
completedForm
.
getField
(
"muc#roomconfig_passwordprotectedroom"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
passwordProtectionChanged
=
true
;
final
String
value
=
field
.
getFirstValue
();
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
boolean
isPasswordProtected
=
"1"
.
equals
(
booleanValue
);
if
(
isPasswordProtected
)
{
// The room is password protected so set the new password
field
=
completedForm
.
getField
(
"muc#roomconfig_roomsecret"
);
if
(
field
!=
null
)
{
final
String
secret
=
completedForm
.
getField
(
"muc#roomconfig_roomsecret"
).
getFirstValue
();
room
.
setPassword
(
secret
);
}
booleanValue
=
(
(
value
!=
null
?
value
:
"1"
)
);
updatedIsPasswordProtected
=
"1"
.
equals
(
booleanValue
);
}
field
=
completedForm
.
getField
(
"muc#roomconfig_roomsecret"
);
if
(
field
!=
null
)
{
passwordChanged
=
true
;
updatedPassword
=
completedForm
.
getField
(
"muc#roomconfig_roomsecret"
).
getFirstValue
();
if
(
updatedPassword
!=
null
&&
updatedPassword
.
isEmpty
()
)
{
updatedPassword
=
null
;
}
else
{
// The room is not password protected so remove any previous password
room
.
setPassword
(
null
);
}
if
(
passwordProtectionChanged
)
{
// The owner signifies that a change in password-protection status is desired.
if
(
!
updatedIsPasswordProtected
)
{
// The owner lifts password protection.
room
.
setPassword
(
null
);
}
else
if
(
updatedPassword
==
null
&&
room
.
getPassword
()
==
null
)
{
// The owner sets password-protection, but does not provide a password (and the room does not already have a password).
throw
new
NotAcceptableException
(
"Room is made password-protected, but is missing a password."
);
}
else
if
(
updatedPassword
!=
null
)
{
// The owner sets password-protection and provided a new password.
room
.
setPassword
(
updatedPassword
);
}
}
else
if
(
passwordChanged
)
{
// The owner did not explicitly signal a password protection change, but did change the password value.
// This implies a change in password protection.
room
.
setPassword
(
updatedPassword
);
}
field
=
completedForm
.
getField
(
"muc#roomconfig_whois"
);
...
...
src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java
View file @
34971f95
...
...
@@ -407,6 +407,9 @@ public class LocalMUCUser implements MUCUser {
}
}
}
catch
(
NotAcceptableException
e
)
{
sendErrorPacket
(
packet
,
PacketError
.
Condition
.
not_acceptable
);
}
catch
(
ForbiddenException
e
)
{
sendErrorPacket
(
packet
,
PacketError
.
Condition
.
forbidden
);
}
...
...
src/web/muc-room-edit-form.jsp
View file @
34971f95
...
...
@@ -389,23 +389,23 @@
<%
if
(
errors
.
get
(
"roomconfig_roomname"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.valid_hint_name"
/>
<%
}
else
if
(
errors
.
get
(
"roomconfig_roomdesc"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"roomconfig_roomdesc"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.valid_hint_description"
/>
<%
}
else
if
(
errors
.
get
(
"roomconfig_maxusers"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"roomconfig_maxusers"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.valid_hint_max_room"
/>
<%
}
else
if
(
errors
.
get
(
"roomconfig_roomsecret2"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"roomconfig_roomsecret2"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.new_password"
/>
<%
}
else
if
(
errors
.
get
(
"roomconfig_whois"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"roomconfig_whois"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.role"
/>
<%
}
else
if
(
errors
.
get
(
"roomconfig_allowpm"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"roomconfig_allowpm"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.role"
/>
<%
}
else
if
(
errors
.
get
(
"roomName"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"roomName"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.valid_hint"
/>
<%
}
else
if
(
errors
.
get
(
"room_already_exists"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"room_already_exists"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.error_created_id"
/>
<%
}
else
if
(
errors
.
get
(
"not_enough_permissions"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"not_enough_permissions"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.error_created_privileges"
/>
<%
}
else
if
(
errors
.
get
(
"room_topic"
)
!=
null
)
{
%>
<%
}
if
(
errors
.
get
(
"room_topic"
)
!=
null
)
{
%>
<fmt:message
key=
"muc.room.edit.form.valid_hint_subject"
/>
<%
}
%>
</td>
...
...
@@ -485,7 +485,7 @@
<tbody>
<%
if
(
create
)
{
%>
<tr>
<td><fmt:message
key=
"muc.room.edit.form.room_id"
/>
:
</td>
<td><fmt:message
key=
"muc.room.edit.form.room_id"
/>
:
*
</td>
<td><input
type=
"text"
name=
"roomName"
value=
"
<%=
StringUtils
.
escapeForXML
(
roomName
)
%>
"
>
<%
if
(
webManager
.
getMultiUserChatManager
().
getMultiUserChatServicesCount
()
>
1
)
{
%>
@
<select
name=
"mucName"
>
...
...
@@ -516,12 +516,12 @@
</tr>
<%
}
%>
<tr>
<td><fmt:message
key=
"muc.room.edit.form.room_name"
/>
:
</td>
<td><fmt:message
key=
"muc.room.edit.form.room_name"
/>
:
*
</td>
<td><input
type=
"text"
name=
"roomconfig_roomname"
value=
"
<%=
(
naturalName
==
null
?
""
:
StringUtils
.
escapeForXML
(
naturalName
))
%>
"
>
</td>
</tr>
<tr>
<td><fmt:message
key=
"muc.room.edit.form.description"
/>
:
</td>
<td><fmt:message
key=
"muc.room.edit.form.description"
/>
:
*
</td>
<td><input
name=
"roomconfig_roomdesc"
value=
"
<%=
(
description
==
null
?
""
:
StringUtils
.
escapeForXML
(
description
))
%>
"
type=
"text"
size=
"40"
>
</td>
</tr>
...
...
@@ -634,6 +634,7 @@
<input
type=
"submit"
name=
"cancel"
value=
"
<fmt:message
key=
"global.cancel"
/>
"
></td>
</tr>
</table>
<span
class=
"jive-description"
>
*
<fmt:message
key=
"muc.room.edit.form.required_field"
/>
</span>
</form>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment