Skip to content

Commit 6e5a630

Browse files
committed
update use schema
1 parent db5dc5b commit 6e5a630

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

server/modules/user/user.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ const schema = Joi.object({
1313
email: Joi.string().email().lowercase().required(),
1414
isActive: Joi.boolean().default(true),
1515
password: Joi.string(),
16-
resetPassword: Joi.object({
17-
token: Joi.string().required(),
18-
expires: Joi.date().required()
19-
}),
20-
verify: Joi.object({
21-
token: Joi.string().required(),
22-
expires: Joi.date().required()
23-
}),
16+
verify: Joi.boolean(),
2417
roles: Joi.object({
2518
admin: Joi.object({
2619
id: Joi.string().required(),
@@ -37,7 +30,7 @@ const schema = Joi.object({
3730

3831
class User extends MongoModels {
3932

40-
static async create(username, password, email, verify) {
33+
static async create(username, password, email) {
4134

4235
Assert.ok(username, 'Missing username argument.');
4336
Assert.ok(password, 'Missing password argument.');
@@ -46,15 +39,12 @@ class User extends MongoModels {
4639
const passwordHash = await this.generatePasswordHash(password);
4740
const user = {
4841
email,
42+
verify: false,
4943
isActive: true,
5044
password: passwordHash.hash,
5145
username
5246
};
5347

54-
if (verify) {
55-
user.verify = verify;
56-
}
57-
5848
const document = new this(user);
5949
const users = await this.insertOne(document);
6050

0 commit comments

Comments
 (0)