Remove unused UserModel properties
- credentials - challenges - status - created - lastUpdated
This commit is contained in:
parent
363bc4d6c1
commit
817e76e424
|
@ -73,3 +73,29 @@ PersistedModel.handleChangeError. This method can be customized on a per-model b
|
||||||
provide different error handling.
|
provide different error handling.
|
||||||
|
|
||||||
Please see [related code change](https://github.com/strongloop/loopback/pull/2308) here.
|
Please see [related code change](https://github.com/strongloop/loopback/pull/2308) here.
|
||||||
|
|
||||||
|
|
||||||
|
## remove unused user properties
|
||||||
|
The following properties are removed from the built-in User model in 3.0:
|
||||||
|
- credentials
|
||||||
|
- challenges
|
||||||
|
- status
|
||||||
|
- created
|
||||||
|
- lastUpdated
|
||||||
|
|
||||||
|
Developers that are relying on these properties, can redefine them in `user.json` or equivalent model.json as follow:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "MyUser",
|
||||||
|
"base": "User",
|
||||||
|
"properties": {
|
||||||
|
"credentials": { "type": "object" },
|
||||||
|
"challenges": { "type": "object" },
|
||||||
|
"status": "string",
|
||||||
|
"created": "date",
|
||||||
|
"lastUpdated": "date"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Please see [Related code change](https://github.com/strongloop/loopback/pull/2299) here.
|
||||||
|
|
|
@ -53,9 +53,6 @@ var debug = require('debug')('loopback:user');
|
||||||
* @property {Boolean} emailVerified Set when a user's email has been verified via `confirm()`.
|
* @property {Boolean} emailVerified Set when a user's email has been verified via `confirm()`.
|
||||||
* @property {String} verificationToken Set when `verify()` is called.
|
* @property {String} verificationToken Set when `verify()` is called.
|
||||||
* @property {String} realm The namespace the user belongs to. See [Partitioning users with realms](https://docs.strongloop.com/display/public/LB/Partitioning+users+with+realms) for details.
|
* @property {String} realm The namespace the user belongs to. See [Partitioning users with realms](https://docs.strongloop.com/display/public/LB/Partitioning+users+with+realms) for details.
|
||||||
* @property {Date} created The property is not used by LoopBack, you are free to use it for your own purposes.
|
|
||||||
* @property {Date} lastUpdated The property is not used by LoopBack, you are free to use it for your own purposes.
|
|
||||||
* @property {String} status The property is not used by LoopBack, you are free to use it for your own purposes.
|
|
||||||
* @property {Object} settings Extends the `Model.settings` object.
|
* @property {Object} settings Extends the `Model.settings` object.
|
||||||
* @property {Boolean} settings.emailVerificationRequired Require the email verification
|
* @property {Boolean} settings.emailVerificationRequired Require the email verification
|
||||||
* process before allowing a login.
|
* process before allowing a login.
|
||||||
|
|
|
@ -11,23 +11,12 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"credentials": {
|
|
||||||
"type": "object",
|
|
||||||
"deprecated": true
|
|
||||||
},
|
|
||||||
"challenges": {
|
|
||||||
"type": "object",
|
|
||||||
"deprecated": true
|
|
||||||
},
|
|
||||||
"email": {
|
"email": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"emailVerified": "boolean",
|
"emailVerified": "boolean",
|
||||||
"verificationToken": "string",
|
"verificationToken": "string"
|
||||||
"status": "string",
|
|
||||||
"created": "date",
|
|
||||||
"lastUpdated": "date"
|
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"caseSensitiveEmail": true
|
"caseSensitiveEmail": true
|
||||||
|
|
|
@ -110,23 +110,6 @@ describe('User', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('credentials/challenges are object types', function(done) {
|
|
||||||
User.create({ email: 'f1@b.com', password: 'bar1',
|
|
||||||
credentials: { cert: 'xxxxx', key: '111' },
|
|
||||||
challenges: { x: 'X', a: 1 },
|
|
||||||
}, function(err, user) {
|
|
||||||
assert(!err);
|
|
||||||
User.findById(user.id, function(err, user) {
|
|
||||||
assert(user.id);
|
|
||||||
assert(user.email);
|
|
||||||
assert.deepEqual(user.credentials, { cert: 'xxxxx', key: '111' });
|
|
||||||
assert.deepEqual(user.challenges, { x: 'X', a: 1 });
|
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Email is required', function(done) {
|
it('Email is required', function(done) {
|
||||||
User.create({ password: '123' }, function(err) {
|
User.create({ password: '123' }, function(err) {
|
||||||
assert(err);
|
assert(err);
|
||||||
|
|
Loading…
Reference in New Issue