mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 07:20:12 +01:00
Revert users changes that were made at Wekan v4.16.
Thanks to xet7 !
This commit is contained in:
parent
0ff1e63a5d
commit
5eb3784527
11 changed files with 26 additions and 26 deletions
|
|
@ -869,7 +869,7 @@ var expirationAuth = function expirationAuth() {
|
||||||
} // 326
|
} // 326
|
||||||
// 327
|
// 327
|
||||||
// We are not on a secure line - so we have to look up the user... // 328
|
// We are not on a secure line - so we have to look up the user... // 328
|
||||||
var user = Users.findOne({ // 329
|
var user = Meteor.users.findOne({ // 329
|
||||||
$or: [ // 330
|
$or: [ // 330
|
||||||
{'services.resume.loginTokens.hashedToken': Accounts._hashLoginToken(userToken)}, // 331
|
{'services.resume.loginTokens.hashedToken': Accounts._hashLoginToken(userToken)}, // 331
|
||||||
{'services.resume.loginTokens.token': userToken} // 332
|
{'services.resume.loginTokens.token': userToken} // 332
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ if (Meteor.isServer) {
|
||||||
const loginToken = req.query.authToken;
|
const loginToken = req.query.authToken;
|
||||||
if (loginToken) {
|
if (loginToken) {
|
||||||
const hashToken = Accounts._hashLoginToken(loginToken);
|
const hashToken = Accounts._hashLoginToken(loginToken);
|
||||||
user = Users.findOne({
|
user = Meteor.users.findOne({
|
||||||
'services.resume.loginTokens.hashedToken': hashToken,
|
'services.resume.loginTokens.hashedToken': hashToken,
|
||||||
});
|
});
|
||||||
} else if (!Meteor.settings.public.sandstorm) {
|
} else if (!Meteor.settings.public.sandstorm) {
|
||||||
|
|
@ -69,7 +69,7 @@ if (Meteor.isServer) {
|
||||||
const loginToken = params.query.authToken;
|
const loginToken = params.query.authToken;
|
||||||
if (loginToken) {
|
if (loginToken) {
|
||||||
const hashToken = Accounts._hashLoginToken(loginToken);
|
const hashToken = Accounts._hashLoginToken(loginToken);
|
||||||
user = Users.findOne({
|
user = Meteor.users.findOne({
|
||||||
'services.resume.loginTokens.hashedToken': hashToken,
|
'services.resume.loginTokens.hashedToken': hashToken,
|
||||||
});
|
});
|
||||||
} else if (!Meteor.settings.public.sandstorm) {
|
} else if (!Meteor.settings.public.sandstorm) {
|
||||||
|
|
|
||||||
|
|
@ -933,7 +933,7 @@ if (Meteor.isServer) {
|
||||||
user.authenticationMethod = 'oauth2';
|
user.authenticationMethod = 'oauth2';
|
||||||
|
|
||||||
// see if any existing user has this email address or username, otherwise create new
|
// 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 }],
|
$or: [{ 'emails.address': email }, { username: user.username }],
|
||||||
});
|
});
|
||||||
if (!existingUser) return user;
|
if (!existingUser) return user;
|
||||||
|
|
@ -946,7 +946,7 @@ if (Meteor.isServer) {
|
||||||
existingUser.profile = user.profile;
|
existingUser.profile = user.profile;
|
||||||
existingUser.authenticationMethod = user.authenticationMethod;
|
existingUser.authenticationMethod = user.authenticationMethod;
|
||||||
|
|
||||||
Meteor.users.remove({ _id: user._id });
|
Meteor.users.remove({ _id: existingUser._id }); // remove existing record
|
||||||
return existingUser;
|
return existingUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1277,7 +1277,7 @@ if (Meteor.isServer) {
|
||||||
JsonRoutes.add('GET', '/api/user', function(req, res) {
|
JsonRoutes.add('GET', '/api/user', function(req, res) {
|
||||||
try {
|
try {
|
||||||
Authentication.checkLoggedIn(req.userId);
|
Authentication.checkLoggedIn(req.userId);
|
||||||
const data = Users.findOne({ _id: req.userId });
|
const data = Meteor.users.findOne({ _id: req.userId });
|
||||||
delete data.services;
|
delete data.services;
|
||||||
|
|
||||||
// get all boards where the user is member of
|
// get all boards where the user is member of
|
||||||
|
|
@ -1368,7 +1368,7 @@ if (Meteor.isServer) {
|
||||||
return u;
|
return u;
|
||||||
});
|
});
|
||||||
|
|
||||||
const user = Users.findOne({ _id: id });
|
const user = Meteor.users.findOne({ _id: id });
|
||||||
user.boards = boards;
|
user.boards = boards;
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
|
|
@ -1404,7 +1404,7 @@ if (Meteor.isServer) {
|
||||||
Authentication.checkUserId(req.userId);
|
Authentication.checkUserId(req.userId);
|
||||||
const id = req.params.userId;
|
const id = req.params.userId;
|
||||||
const action = req.body.action;
|
const action = req.body.action;
|
||||||
let data = Users.findOne({ _id: id });
|
let data = Meteor.users.findOne({ _id: id });
|
||||||
if (data !== undefined) {
|
if (data !== undefined) {
|
||||||
if (action === 'takeOwnership') {
|
if (action === 'takeOwnership') {
|
||||||
data = Boards.find(
|
data = Boards.find(
|
||||||
|
|
@ -1437,7 +1437,7 @@ if (Meteor.isServer) {
|
||||||
} else if (action === 'enableLogin') {
|
} else if (action === 'enableLogin') {
|
||||||
Users.update({ _id: id }, { $set: { loginDisabled: '' } });
|
Users.update({ _id: id }, { $set: { loginDisabled: '' } });
|
||||||
}
|
}
|
||||||
data = Users.findOne({ _id: id });
|
data = Meteor.users.findOne({ _id: id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JsonRoutes.sendResult(res, {
|
JsonRoutes.sendResult(res, {
|
||||||
|
|
@ -1481,7 +1481,7 @@ if (Meteor.isServer) {
|
||||||
const boardId = req.params.boardId;
|
const boardId = req.params.boardId;
|
||||||
const action = req.body.action;
|
const action = req.body.action;
|
||||||
const { isAdmin, isNoComments, isCommentOnly } = req.body;
|
const { isAdmin, isNoComments, isCommentOnly } = req.body;
|
||||||
let data = Users.findOne({ _id: userId });
|
let data = Meteor.users.findOne({ _id: userId });
|
||||||
if (data !== undefined) {
|
if (data !== undefined) {
|
||||||
if (action === 'add') {
|
if (action === 'add') {
|
||||||
data = Boards.find({
|
data = Boards.find({
|
||||||
|
|
@ -1542,7 +1542,7 @@ if (Meteor.isServer) {
|
||||||
const userId = req.params.userId;
|
const userId = req.params.userId;
|
||||||
const boardId = req.params.boardId;
|
const boardId = req.params.boardId;
|
||||||
const action = req.body.action;
|
const action = req.body.action;
|
||||||
let data = Users.findOne({ _id: userId });
|
let data = Meteor.users.findOne({ _id: userId });
|
||||||
if (data !== undefined) {
|
if (data !== undefined) {
|
||||||
if (action === 'remove') {
|
if (action === 'remove') {
|
||||||
data = Boards.find({
|
data = Boards.find({
|
||||||
|
|
|
||||||
|
|
@ -252,13 +252,13 @@ const casValidate = (req, ticket, token, service, callback) => {
|
||||||
if (attrs.debug) {
|
if (attrs.debug) {
|
||||||
console.log(`CAS response : ${JSON.stringify(result)}`);
|
console.log(`CAS response : ${JSON.stringify(result)}`);
|
||||||
}
|
}
|
||||||
let user = Users.findOne({ 'username': options.username });
|
let user = Meteor.users.findOne({ 'username': options.username });
|
||||||
if (! user) {
|
if (! user) {
|
||||||
if (attrs.debug) {
|
if (attrs.debug) {
|
||||||
console.log(`Creating user account ${JSON.stringify(options)}`);
|
console.log(`Creating user account ${JSON.stringify(options)}`);
|
||||||
}
|
}
|
||||||
const userId = Accounts.insertUserDoc({}, options);
|
const userId = Accounts.insertUserDoc({}, options);
|
||||||
user = Users.findOne(userId);
|
user = Meteor.users.findOne(userId);
|
||||||
}
|
}
|
||||||
if (attrs.debug) {
|
if (attrs.debug) {
|
||||||
console.log(`Using user account ${JSON.stringify(user)}`);
|
console.log(`Using user account ${JSON.stringify(user)}`);
|
||||||
|
|
|
||||||
|
|
@ -804,7 +804,7 @@ If, differently, you do something like this:
|
||||||
if (Meteor.isServer){
|
if (Meteor.isServer){
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
"userExists": function(username){
|
"userExists": function(username){
|
||||||
return !!Users.findOne({username: username});
|
return !!Meteor.users.findOne({username: username});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Meteor.methods({
|
||||||
var userId = this.userId;
|
var userId = this.userId;
|
||||||
|
|
||||||
if (userId) {
|
if (userId) {
|
||||||
var user = Users.findOne(userId);
|
var user = Meteor.users.findOne(userId);
|
||||||
var numServices = _.keys(user.services).length; // including "resume"
|
var numServices = _.keys(user.services).length; // including "resume"
|
||||||
var unset = {};
|
var unset = {};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ AT.prototype._init = function() {
|
||||||
return Meteor.users.find(userId, {fields: {services: 1}});
|
return Meteor.users.find(userId, {fields: {services: 1}});
|
||||||
/*
|
/*
|
||||||
if (userId) {
|
if (userId) {
|
||||||
var user = Users.findOne(userId);
|
var user = Meteor.users.findOne(userId);
|
||||||
var services_id = _.chain(user.services)
|
var services_id = _.chain(user.services)
|
||||||
.keys()
|
.keys()
|
||||||
.reject(function(service) {return service === "resume";})
|
.reject(function(service) {return service === "resume";})
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ Meteor.methods({
|
||||||
ATResendVerificationEmail: function (email) {
|
ATResendVerificationEmail: function (email) {
|
||||||
check(email, String);
|
check(email, String);
|
||||||
|
|
||||||
var user = Users.findOne({ "emails.address": email });
|
var user = Meteor.users.findOne({ "emails.address": email });
|
||||||
|
|
||||||
// Send the standard error back to the client if no user exist with this e-mail
|
// Send the standard error back to the client if no user exist with this e-mail
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
||||||
log_info('Querying user');
|
log_info('Querying user');
|
||||||
log_debug('userQuery', userQuery);
|
log_debug('userQuery', userQuery);
|
||||||
|
|
||||||
user = Users.findOne(userQuery);
|
user = Meteor.users.findOne(userQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to find user by username
|
// Attempt to find user by username
|
||||||
|
|
@ -137,7 +137,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
||||||
|
|
||||||
log_debug('userQuery', userQuery);
|
log_debug('userQuery', userQuery);
|
||||||
|
|
||||||
user = Users.findOne(userQuery);
|
user = Meteor.users.findOne(userQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to find user by e-mail address only
|
// Attempt to find user by e-mail address only
|
||||||
|
|
@ -159,7 +159,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {
|
||||||
|
|
||||||
log_debug('userQuery', userQuery);
|
log_debug('userQuery', userQuery);
|
||||||
|
|
||||||
user = Users.findOne(userQuery);
|
user = Meteor.users.findOne(userQuery);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ export function syncUserData(user, ldapUser) {
|
||||||
const username = slug(getLdapUsername(ldapUser));
|
const username = slug(getLdapUsername(ldapUser));
|
||||||
if (user && user._id && username !== user.username) {
|
if (user && user._id && username !== user.username) {
|
||||||
log_info('Syncing user username', user.username, '->', username);
|
log_info('Syncing user username', user.username, '->', username);
|
||||||
Users.findOne({ _id: user._id }, { $set: { username }});
|
Meteor.users.findOne({ _id: user._id }, { $set: { username }});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ export function importNewUsers(ldap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add user if it was not added before
|
// Add user if it was not added before
|
||||||
let user = Users.findOne(userQuery);
|
let user = Meteor.users.findOne(userQuery);
|
||||||
|
|
||||||
if (!user && username && LDAP.settings_get('LDAP_MERGE_EXISTING_USERS') === true) {
|
if (!user && username && LDAP.settings_get('LDAP_MERGE_EXISTING_USERS') === true) {
|
||||||
const userQuery = {
|
const userQuery = {
|
||||||
|
|
@ -350,7 +350,7 @@ export function importNewUsers(ldap) {
|
||||||
|
|
||||||
log_debug('userQuery merge', userQuery);
|
log_debug('userQuery merge', userQuery);
|
||||||
|
|
||||||
user = Users.findOne(userQuery);
|
user = Meteor.users.findOne(userQuery);
|
||||||
if (user) {
|
if (user) {
|
||||||
syncUserData(user, ldapUser);
|
syncUserData(user, ldapUser);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ if (isSandstorm && Meteor.isServer) {
|
||||||
const users = {};
|
const users = {};
|
||||||
function ensureUserListed(userId) {
|
function ensureUserListed(userId) {
|
||||||
if (!users[userId]) {
|
if (!users[userId]) {
|
||||||
const user = Users.findOne(userId);
|
const user = Meteor.users.findOne(userId);
|
||||||
if (user) {
|
if (user) {
|
||||||
users[userId] = { id: user.services.sandstorm.id };
|
users[userId] = { id: user.services.sandstorm.id };
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -217,7 +217,7 @@ if (isSandstorm && Meteor.isServer) {
|
||||||
'userId',
|
'userId',
|
||||||
);
|
);
|
||||||
(comment.text.match(/\B@([\w.]*)/g) || []).forEach(username => {
|
(comment.text.match(/\B@([\w.]*)/g) || []).forEach(username => {
|
||||||
const user = Users.findOne({
|
const user = Meteor.users.findOne({
|
||||||
username: username.slice(1),
|
username: username.slice(1),
|
||||||
});
|
});
|
||||||
if (user && activeMembers.indexOf(user._id) !== -1) {
|
if (user && activeMembers.indexOf(user._id) !== -1) {
|
||||||
|
|
@ -368,7 +368,7 @@ if (isSandstorm && Meteor.isServer) {
|
||||||
if (newMethods[key].auth) {
|
if (newMethods[key].auth) {
|
||||||
newMethods[key].auth = function() {
|
newMethods[key].auth = function() {
|
||||||
const sandstormID = this.req.headers['x-sandstorm-user-id'];
|
const sandstormID = this.req.headers['x-sandstorm-user-id'];
|
||||||
const user = Users.findOne({
|
const user = Meteor.users.findOne({
|
||||||
'services.sandstorm.id': sandstormID,
|
'services.sandstorm.id': sandstormID,
|
||||||
});
|
});
|
||||||
return user && user._id;
|
return user && user._id;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue