fix acls access for user exists remote method
This commit is contained in:
@@ -64,17 +64,26 @@ module.exports = function(app) {
|
||||
});
|
||||
|
||||
User.doesExist = function doesExist(username, email, cb) {
|
||||
if (!username && !email) {
|
||||
return process.nextTick(function() {
|
||||
cb(null, false);
|
||||
});
|
||||
}
|
||||
debug('checking existence');
|
||||
var where = {};
|
||||
if (username) {
|
||||
where.username = username;
|
||||
where.username = username.toLowerCase();
|
||||
} else {
|
||||
where.email = email;
|
||||
where.email = email ? email.toLowerCase() : email;
|
||||
}
|
||||
debug('where', where);
|
||||
User.count(
|
||||
{ where: where },
|
||||
where,
|
||||
function (err, count) {
|
||||
if (err) { return cb(err); }
|
||||
if (err) {
|
||||
debug('err checking existance: ', err);
|
||||
return cb(err);
|
||||
}
|
||||
if (count > 0) {
|
||||
return cb(null, true);
|
||||
}
|
||||
@@ -104,7 +113,8 @@ module.exports = function(app) {
|
||||
}
|
||||
],
|
||||
http: {
|
||||
path: '/exists'
|
||||
path: '/exists',
|
||||
verb: 'get'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user