mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
fix(chat): validate group membership, by @phillipthelen
This commit is contained in:
@@ -432,6 +432,7 @@ api.updateEmail = {
|
||||
}
|
||||
|
||||
user.auth.local.email = req.body.newEmail.toLowerCase();
|
||||
user.auth.local.passwordResetCode = undefined;
|
||||
await user.save();
|
||||
|
||||
return res.respond(200, { email: user.auth.local.email });
|
||||
|
||||
@@ -295,7 +295,7 @@ api.likeChat = {
|
||||
const group = await Group.getGroup({ user, groupId });
|
||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||
|
||||
const message = await Chat.findOne({ _id: req.params.chatId }).exec();
|
||||
const message = await Chat.findOne({ _id: req.params.chatId, groupId: group._id }).exec();
|
||||
if (!message) throw new NotFound(res.t('messageGroupChatNotFound'));
|
||||
if (!message.likes) message.likes = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user