Merge pull request #956 from clarkorz/fix/user-settings-ttl
fix User.settings.ttl can't be overridden in sub model
This commit is contained in:
commit
38bb8f9064
|
@ -464,7 +464,7 @@ module.exports = function(User) {
|
||||||
|
|
||||||
// max ttl
|
// max ttl
|
||||||
this.settings.maxTTL = this.settings.maxTTL || DEFAULT_MAX_TTL;
|
this.settings.maxTTL = this.settings.maxTTL || DEFAULT_MAX_TTL;
|
||||||
this.settings.ttl = DEFAULT_TTL;
|
this.settings.ttl = this.settings.ttl || DEFAULT_TTL;
|
||||||
|
|
||||||
UserModel.setter.password = function(plain) {
|
UserModel.setter.password = function(plain) {
|
||||||
var salt = bcrypt.genSaltSync(this.constructor.settings.saltWorkFactor || SALT_WORK_FACTOR);
|
var salt = bcrypt.genSaltSync(this.constructor.settings.saltWorkFactor || SALT_WORK_FACTOR);
|
||||||
|
|
|
@ -808,4 +808,14 @@ describe('User', function() {
|
||||||
expect(User.accessToken.modelName, 'modelName').to.eql('AccessToken');
|
expect(User.accessToken.modelName, 'modelName').to.eql('AccessToken');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('ttl', function() {
|
||||||
|
var User2;
|
||||||
|
beforeEach(function() {
|
||||||
|
User2 = loopback.User.extend('User2', {}, { ttl: 10 });
|
||||||
|
});
|
||||||
|
it('should override ttl setting in based User model', function() {
|
||||||
|
expect(User2.settings.ttl).to.equal(10);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue