Skip to content

Commit

Permalink
Users must be different from admins
Browse files Browse the repository at this point in the history
  • Loading branch information
coditva committed Mar 4, 2017
1 parent 570cd61 commit 4f84f9b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion passport_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ module.exports = function(app, passport){
return cb(null, false, {message:"User already registered"});
}
else{
app.db.users.insert({username: username, password:password});
// Must not be the same as admins
app.db.admins.findOne({username: username}, function(err, user) {
if (err) {
return cb(err);
}
if (user) {
return cb(null, false, {message:"User already registered"});
}
else{
app.db.users.insert({username: username, password:password});
}
});
}
});
}else
Expand Down

0 comments on commit 4f84f9b

Please sign in to comment.