Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. var employee =
  2. {
  3. empCode : { type : String , unique: true , required : true },
  4. firstName : { type : String , required : true },
  5. lastName : { type : String },
  6. email : { type : String },
  7. DOJ :{ type : Date , default: Date.now },
  8. DOB :{ type : Date },
  9. phoneNo : { type : String },
  10. authentication :
  11. {
  12. username : { type : String },
  13. password : { type : String }
  14. },
  15.  
  16. status : {type:Boolean}
  17. };
  18.  
  19. loginController.prototype.userValidator = function(req , callback){
  20. objDB.selectOne(objMdlEmployee , { authentication.username : req.username , authentication.password : req.password } , function(err , ObjDocument){
  21.  
  22. if(err){
  23. callback(false , config.msg.SOMTHING_WRONG);
  24. }else if(ObjDocument===null){
  25. callback(false , config.msg.AUTH_FAIL);
  26. }
  27. else {
  28. req.session.sessUser = {
  29. userAuthenticate : true,
  30. firstName : ObjDocument.firstName,
  31. employeeId : ObjDocument.employeeId
  32. }
  33. callback(true , 'Valid');
  34. }
  35. });
  36. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement