Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Email confirmed test #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Email confirmed test #17

wants to merge 5 commits into from

Conversation

DmytroBaziuk
Copy link
Contributor

Я сделаль)

@@ -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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{type: boolean, default: false}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

});

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,) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant , at the end

Copy link
Contributor Author

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},
Copy link
Member

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}

Copy link
Contributor Author

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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emailConfirmed: false,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -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
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants