Answer the question
In order to leave comments, you need to log in
How to organize registration, authorization and roles in a Node.js application?
Good afternoon. I reached user authorization in my application (Node.js + Angular2 + MongoDb) Before trying, I would like to clarify some things for myself:
1) I do registration as usual - username, password ..... - before saving to node .js I check for uniqueness and do
UserSchema.pre('save', function (next) {
if (this.password && this.isModified('password')) {
this.salt = crypto.randomBytes(16).toString('base64');
this.password = this.hashPassword(this.password);
}
next();
});
Is it so? Is this crypto enough to save the password? var BlogPost = new Schema({
title: {
type: String
},
content: {
type: String
},
date: Date,
UserAccess : {
// User_id1, User_id2,User_id3
}
});
Answer the question
In order to leave comments, you need to log in
Of course, I could be wrong, but see how it is implemented here - http://mean.io/#!/ or here - meanjs.org . I used meanjs.org a couple of years ago and everything was there out of the box.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question