Closed d0peCode closed 5 years ago
@d0peCode can you please check why travis build fails?
@d0peCode can you pull from master? made some changes to fix travis
Merge remote-tracking branch 'upstream/master' into emailConfirmation
Travis is still failing:
npm ERR! Missing: nodemailer@^6.2.1 npm ERR! Missing: uuid@^3.3.2
Now it works 💯
Thanks, @d0peCode you did a great job
Added email confirmation feature:
config/index.js
README.md
udpated to additional tips about setting transporteruuid
package to create unique key for account activationtransporter.js
in servicesactive: Boolean
andactivationKey: String
in user modeluserSchema.post('save', async function
with function which is sending email after save in user.model file (below .pre hook)if (!user.active) throw new APIError(
User not activated, httpStatus.UNAUTHORIZED)
in user.model file withinfindAndGenerateToken
function, in order to not let inactive user login./confirm
route which is invoked after clicking link from mail.Please do code review. Especially things I don't know are:
userSchema.method({
there is this arrayconst fields = ['id', 'name', 'email', 'createdAt', 'role']
shoudn't it contain two new fields (active
andactivationKey
)?in
.pre
hook there is this condition: