SHARE
TWEET

Untitled

a guest Jun 15th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. route '/auth/:operation/:param?'
  2.  
  3. (I have some logic that takes :operation and chooses a function, this never gets called)
  4.  
  5.  
  6. do_login_page:function(req,res){
  7.        
  8.         var username = req.param("user");
  9.         var password = md5(req.param("pass"));
  10.        
  11.        
  12.        
  13.         user.find({"user" : username, "pass" : password}).first(function(userObj) {
  14.        
  15.             if (userObj != null && userObj.user != null) {
  16.                 req.session.user = userObj.user
  17.                 req.session.fullname = userObj.name;
  18.                 req.session.type = userObj.type;
  19.                 req.session.user_id = userObj._id;
  20.                
  21.                 res.redirect("/dashboard");
  22.             } else {
  23.            
  24.                 req.flash('login_info', 'Oops, login failed');
  25.                 res.redirect("/auth/login");
  26.             }
  27.    
  28.         });
  29.        
  30.        
  31.     }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top