Merge pull request #3166 from strongloop/upgrade/eslint-config
Upgrade eslint config, fix linter errors
This commit is contained in:
commit
c7e0a15a44
|
@ -293,8 +293,9 @@ module.exports = function(User) {
|
||||||
User.logout = function(tokenId, fn) {
|
User.logout = function(tokenId, fn) {
|
||||||
fn = fn || utils.createPromiseCallback();
|
fn = fn || utils.createPromiseCallback();
|
||||||
|
|
||||||
|
var err;
|
||||||
if (!tokenId) {
|
if (!tokenId) {
|
||||||
var err = new Error(g.f('{{accessToken}} is required to logout'));
|
err = new Error(g.f('{{accessToken}} is required to logout'));
|
||||||
err.status = 401;
|
err.status = 401;
|
||||||
process.nextTick(fn, err);
|
process.nextTick(fn, err);
|
||||||
return fn.promise;
|
return fn.promise;
|
||||||
|
@ -304,7 +305,7 @@ module.exports = function(User) {
|
||||||
if (err) {
|
if (err) {
|
||||||
fn(err);
|
fn(err);
|
||||||
} else if ('count' in info && info.count === 0) {
|
} else if ('count' in info && info.count === 0) {
|
||||||
var err = new Error(g.f('Could not find {{accessToken}}'));
|
err = new Error(g.f('Could not find {{accessToken}}'));
|
||||||
err.status = 401;
|
err.status = 401;
|
||||||
fn(err);
|
fn(err);
|
||||||
} else {
|
} else {
|
||||||
|
@ -867,10 +868,9 @@ module.exports = function(User) {
|
||||||
if (ctx.isNewInstance) return next();
|
if (ctx.isNewInstance) return next();
|
||||||
if (!ctx.where && !ctx.instance) return next();
|
if (!ctx.where && !ctx.instance) return next();
|
||||||
var pkName = ctx.Model.definition.idName() || 'id';
|
var pkName = ctx.Model.definition.idName() || 'id';
|
||||||
if (ctx.where) {
|
var where = ctx.where;
|
||||||
var where = ctx.where;
|
if (!where) {
|
||||||
} else {
|
where = {};
|
||||||
var where = {};
|
|
||||||
where[pkName] = ctx.instance[pkName];
|
where[pkName] = ctx.instance[pkName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,13 +893,14 @@ module.exports = function(User) {
|
||||||
user['email'] = u['email'];
|
user['email'] = u['email'];
|
||||||
return user;
|
return user;
|
||||||
});
|
});
|
||||||
|
var emailChanged;
|
||||||
if (ctx.instance) {
|
if (ctx.instance) {
|
||||||
var emailChanged = ctx.instance.email !== ctx.hookState.originalUserData[0].email;
|
emailChanged = ctx.instance.email !== ctx.hookState.originalUserData[0].email;
|
||||||
if (emailChanged && ctx.Model.settings.emailVerificationRequired) {
|
if (emailChanged && ctx.Model.settings.emailVerificationRequired) {
|
||||||
ctx.instance.emailVerified = false;
|
ctx.instance.emailVerified = false;
|
||||||
}
|
}
|
||||||
} else if (ctx.data.email) {
|
} else if (ctx.data.email) {
|
||||||
var emailChanged = ctx.hookState.originalUserData.some(function(data) {
|
emailChanged = ctx.hookState.originalUserData.some(function(data) {
|
||||||
return data.email != ctx.data.email;
|
return data.email != ctx.data.email;
|
||||||
});
|
});
|
||||||
if (emailChanged && ctx.Model.settings.emailVerificationRequired) {
|
if (emailChanged && ctx.Model.settings.emailVerificationRequired) {
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"cookie-parser": "^1.3.4",
|
"cookie-parser": "^1.3.4",
|
||||||
"dirty-chai": "^1.2.2",
|
"dirty-chai": "^1.2.2",
|
||||||
"eslint-config-loopback": "^7.0.1",
|
"eslint-config-loopback": "^8.0.0",
|
||||||
"express-session": "^1.14.0",
|
"express-session": "^1.14.0",
|
||||||
"grunt": "^1.0.1",
|
"grunt": "^1.0.1",
|
||||||
"grunt-browserify": "^5.0.0",
|
"grunt-browserify": "^5.0.0",
|
||||||
|
|
Loading…
Reference in New Issue