From 5eb378452761ad1d6d67a491316007fdf6dfd689 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Thu, 18 Jun 2020 02:00:51 +0300 Subject: Revert users changes that were made at Wekan v4.16. Thanks to xet7 ! --- models/users.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'models/users.js') diff --git a/models/users.js b/models/users.js index d1a85c37..2b5a059e 100644 --- a/models/users.js +++ b/models/users.js @@ -933,7 +933,7 @@ if (Meteor.isServer) { user.authenticationMethod = 'oauth2'; // see if any existing user has this email address or username, otherwise create new - const existingUser = Users.findOne({ + const existingUser = Meteor.users.findOne({ $or: [{ 'emails.address': email }, { username: user.username }], }); if (!existingUser) return user; @@ -946,7 +946,7 @@ if (Meteor.isServer) { existingUser.profile = user.profile; existingUser.authenticationMethod = user.authenticationMethod; - Meteor.users.remove({ _id: user._id }); + Meteor.users.remove({ _id: existingUser._id }); // remove existing record return existingUser; } @@ -1277,7 +1277,7 @@ if (Meteor.isServer) { JsonRoutes.add('GET', '/api/user', function(req, res) { try { Authentication.checkLoggedIn(req.userId); - const data = Users.findOne({ _id: req.userId }); + const data = Meteor.users.findOne({ _id: req.userId }); delete data.services; // get all boards where the user is member of @@ -1368,7 +1368,7 @@ if (Meteor.isServer) { return u; }); - const user = Users.findOne({ _id: id }); + const user = Meteor.users.findOne({ _id: id }); user.boards = boards; JsonRoutes.sendResult(res, { code: 200, @@ -1404,7 +1404,7 @@ if (Meteor.isServer) { Authentication.checkUserId(req.userId); const id = req.params.userId; const action = req.body.action; - let data = Users.findOne({ _id: id }); + let data = Meteor.users.findOne({ _id: id }); if (data !== undefined) { if (action === 'takeOwnership') { data = Boards.find( @@ -1437,7 +1437,7 @@ if (Meteor.isServer) { } else if (action === 'enableLogin') { Users.update({ _id: id }, { $set: { loginDisabled: '' } }); } - data = Users.findOne({ _id: id }); + data = Meteor.users.findOne({ _id: id }); } } JsonRoutes.sendResult(res, { @@ -1481,7 +1481,7 @@ if (Meteor.isServer) { const boardId = req.params.boardId; const action = req.body.action; const { isAdmin, isNoComments, isCommentOnly } = req.body; - let data = Users.findOne({ _id: userId }); + let data = Meteor.users.findOne({ _id: userId }); if (data !== undefined) { if (action === 'add') { data = Boards.find({ @@ -1542,7 +1542,7 @@ if (Meteor.isServer) { const userId = req.params.userId; const boardId = req.params.boardId; const action = req.body.action; - let data = Users.findOne({ _id: userId }); + let data = Meteor.users.findOne({ _id: userId }); if (data !== undefined) { if (action === 'remove') { data = Boards.find({ -- cgit v1.2.3-1-g7c22