mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Update users.js etc with global search replace, to try to fix selecting correct user.
Thanks to xet7 !
This commit is contained in:
parent
ad87f9ff4e
commit
f245b6b7fa
12 changed files with 26 additions and 26 deletions
|
@ -869,7 +869,7 @@ var expirationAuth = function expirationAuth() {
|
|||
} // 326
|
||||
// 327
|
||||
// We are not on a secure line - so we have to look up the user... // 328
|
||||
var user = Meteor.users.findOne({ // 329
|
||||
var user = Users.findOne({ // 329
|
||||
$or: [ // 330
|
||||
{'services.resume.loginTokens.hashedToken': Accounts._hashLoginToken(userToken)}, // 331
|
||||
{'services.resume.loginTokens.token': userToken} // 332
|
||||
|
|
|
@ -28,7 +28,7 @@ if (Meteor.isServer) {
|
|||
const loginToken = req.query.authToken;
|
||||
if (loginToken) {
|
||||
const hashToken = Accounts._hashLoginToken(loginToken);
|
||||
user = Meteor.users.findOne({
|
||||
user = Users.findOne({
|
||||
'services.resume.loginTokens.hashedToken': hashToken,
|
||||
});
|
||||
} else if (!Meteor.settings.public.sandstorm) {
|
||||
|
@ -69,7 +69,7 @@ if (Meteor.isServer) {
|
|||
const loginToken = params.query.authToken;
|
||||
if (loginToken) {
|
||||
const hashToken = Accounts._hashLoginToken(loginToken);
|
||||
user = Meteor.users.findOne({
|
||||
user = Users.findOne({
|
||||
'services.resume.loginTokens.hashedToken': hashToken,
|
||||
});
|
||||
} else if (!Meteor.settings.public.sandstorm) {
|
||||
|
|
|
@ -1277,7 +1277,7 @@ if (Meteor.isServer) {
|
|||
JsonRoutes.add('GET', '/api/user', function(req, res) {
|
||||
try {
|
||||
Authentication.checkLoggedIn(req.userId);
|
||||
const data = Meteor.users.findOne({ _id: req.userId });
|
||||
const data = 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 = Meteor.users.findOne({ _id: id });
|
||||
const user = 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 = Meteor.users.findOne({ _id: id });
|
||||
let data = 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 = Meteor.users.findOne({ _id: id });
|
||||
data = 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 = Meteor.users.findOne({ _id: userId });
|
||||
let data = 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 = Meteor.users.findOne({ _id: userId });
|
||||
let data = Users.findOne({ _id: userId });
|
||||
if (data !== undefined) {
|
||||
if (action === 'remove') {
|
||||
data = Boards.find({
|
||||
|
|
|
@ -252,13 +252,13 @@ const casValidate = (req, ticket, token, service, callback) => {
|
|||
if (attrs.debug) {
|
||||
console.log(`CAS response : ${JSON.stringify(result)}`);
|
||||
}
|
||||
let user = Meteor.users.findOne({ 'username': options.username });
|
||||
let user = Users.findOne({ 'username': options.username });
|
||||
if (! user) {
|
||||
if (attrs.debug) {
|
||||
console.log(`Creating user account ${JSON.stringify(options)}`);
|
||||
}
|
||||
const userId = Accounts.insertUserDoc({}, options);
|
||||
user = Meteor.users.findOne(userId);
|
||||
user = Users.findOne(userId);
|
||||
}
|
||||
if (attrs.debug) {
|
||||
console.log(`Using user account ${JSON.stringify(user)}`);
|
||||
|
|
|
@ -804,7 +804,7 @@ If, differently, you do something like this:
|
|||
if (Meteor.isServer){
|
||||
Meteor.methods({
|
||||
"userExists": function(username){
|
||||
return !!Meteor.users.findOne({username: username});
|
||||
return !!Users.findOne({username: username});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ Meteor.methods({
|
|||
var userId = this.userId;
|
||||
|
||||
if (userId) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
var user = Users.findOne(userId);
|
||||
var numServices = _.keys(user.services).length; // including "resume"
|
||||
var unset = {};
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ AT.prototype._init = function() {
|
|||
return Meteor.users.find(userId, {fields: {services: 1}});
|
||||
/*
|
||||
if (userId) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
var user = Users.findOne(userId);
|
||||
var services_id = _.chain(user.services)
|
||||
.keys()
|
||||
.reject(function(service) {return service === "resume";})
|
||||
|
|
|
@ -124,7 +124,7 @@ Meteor.methods({
|
|||
ATResendVerificationEmail: function (email) {
|
||||
check(email, String);
|
||||
|
||||
var user = Meteor.users.findOne({ "emails.address": email });
|
||||
var user = Users.findOne({ "emails.address": email });
|
||||
|
||||
// Send the standard error back to the client if no user exist with this e-mail
|
||||
if (!user) {
|
||||
|
|
|
@ -229,13 +229,13 @@ const casValidate = (req, ticket, token, service, callback) => {
|
|||
if (attrs.debug) {
|
||||
console.log(`CAS response : ${JSON.stringify(result)}`);
|
||||
}
|
||||
let user = Meteor.users.findOne({ 'username': options.username });
|
||||
let user = Users.findOne({ 'username': options.username });
|
||||
if (! user) {
|
||||
if (attrs.debug) {
|
||||
console.log(`Creating user account ${JSON.stringify(options)}`);
|
||||
}
|
||||
const userId = Accounts.insertUserDoc({}, options);
|
||||
user = Meteor.users.findOne(userId);
|
||||
user = Users.findOne(userId);
|
||||
}
|
||||
if (attrs.debug) {
|
||||
console.log(`Using user account ${JSON.stringify(user)}`);
|
||||
|
|
|
@ -96,7 +96,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
|||
log_info('Querying user');
|
||||
log_debug('userQuery', userQuery);
|
||||
|
||||
user = Meteor.users.findOne(userQuery);
|
||||
user = Users.findOne(userQuery);
|
||||
}
|
||||
|
||||
// Attempt to find user by username
|
||||
|
@ -137,7 +137,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
|||
|
||||
log_debug('userQuery', userQuery);
|
||||
|
||||
user = Meteor.users.findOne(userQuery);
|
||||
user = Users.findOne(userQuery);
|
||||
}
|
||||
|
||||
// Attempt to find user by e-mail address only
|
||||
|
@ -159,7 +159,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
|||
|
||||
log_debug('userQuery', userQuery);
|
||||
|
||||
user = Meteor.users.findOne(userQuery);
|
||||
user = Users.findOne(userQuery);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ export function syncUserData(user, ldapUser) {
|
|||
const username = slug(getLdapUsername(ldapUser));
|
||||
if (user && user._id && username !== user.username) {
|
||||
log_info('Syncing user username', user.username, '->', username);
|
||||
Meteor.users.findOne({ _id: user._id }, { $set: { username }});
|
||||
Users.findOne({ _id: user._id }, { $set: { username }});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ export function importNewUsers(ldap) {
|
|||
}
|
||||
|
||||
// Add user if it was not added before
|
||||
let user = Meteor.users.findOne(userQuery);
|
||||
let user = Users.findOne(userQuery);
|
||||
|
||||
if (!user && username && LDAP.settings_get('LDAP_MERGE_EXISTING_USERS') === true) {
|
||||
const userQuery = {
|
||||
|
@ -350,7 +350,7 @@ export function importNewUsers(ldap) {
|
|||
|
||||
log_debug('userQuery merge', userQuery);
|
||||
|
||||
user = Meteor.users.findOne(userQuery);
|
||||
user = Users.findOne(userQuery);
|
||||
if (user) {
|
||||
syncUserData(user, ldapUser);
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ if (isSandstorm && Meteor.isServer) {
|
|||
const users = {};
|
||||
function ensureUserListed(userId) {
|
||||
if (!users[userId]) {
|
||||
const user = Meteor.users.findOne(userId);
|
||||
const user = Users.findOne(userId);
|
||||
if (user) {
|
||||
users[userId] = { id: user.services.sandstorm.id };
|
||||
} else {
|
||||
|
@ -217,7 +217,7 @@ if (isSandstorm && Meteor.isServer) {
|
|||
'userId',
|
||||
);
|
||||
(comment.text.match(/\B@([\w.]*)/g) || []).forEach(username => {
|
||||
const user = Meteor.users.findOne({
|
||||
const user = Users.findOne({
|
||||
username: username.slice(1),
|
||||
});
|
||||
if (user && activeMembers.indexOf(user._id) !== -1) {
|
||||
|
@ -368,7 +368,7 @@ if (isSandstorm && Meteor.isServer) {
|
|||
if (newMethods[key].auth) {
|
||||
newMethods[key].auth = function() {
|
||||
const sandstormID = this.req.headers['x-sandstorm-user-id'];
|
||||
const user = Meteor.users.findOne({
|
||||
const user = Users.findOne({
|
||||
'services.sandstorm.id': sandstormID,
|
||||
});
|
||||
return user && user._id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue