-
Notifications
You must be signed in to change notification settings - Fork 0
Email confirmed test #17
base: master
Are you sure you want to change the base?
Conversation
app/models/user.js
Outdated
@@ -10,21 +10,23 @@ module.exports = function (modelHelpers, connection, mongoose) { | |||
email: {type: String, required: true}, | |||
name: {type: String, required: true}, | |||
avatar: String, | |||
roles: [{type: mongoose.Schema.Types.ObjectId, ref: 'UserRole'}] | |||
roles: [{type: mongoose.Schema.Types.ObjectId, ref: 'UserRole'}], | |||
emailConfirmed : {type: boolean} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{type: boolean, default: false}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/models/user.js
Outdated
}); | ||
|
||
userSchema.methods.toString = function () { | ||
return this.username; | ||
}; | ||
|
||
userSchema.statics.generateNew = function (username, password, email, name, avatar, defaultRole) { | ||
userSchema.statics.generateNew = function (username, password, email, name, avatar, defaultRole,) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant ,
at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -126,6 +126,7 @@ describe('The entity', function() { | |||
email: {type: String, required: true}, | |||
name: {type: String, required: true}, | |||
avatar: String, | |||
emailConfirmed : {type: boolean, required: true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be same as above {type: boolean, default: false}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -143,6 +144,7 @@ describe('The entity', function() { | |||
email: 'test email', | |||
name: 'test name', | |||
avatar: 'test avatar', | |||
emailConfirmed: 'test emailConfirmed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emailConfirmed: false,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/config/passport.js
Outdated
@@ -12,7 +12,8 @@ module.exports = function (passport, passportHelpers, models, moment, BasicStrat | |||
function (username, password, done) { | |||
User.findOne({ | |||
username: username, | |||
password: password | |||
password: password, | |||
emailConfirmed: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, as we are not ready yet to send actual mails and validating them, let's allow unconfirmed mails to login. Hence it would be emailConfirmed: false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Я сделаль)