Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({type:"POST",data:JSON.stringify({ "username": "username","password":"password"}),url:"http://localhost/login"}).done(function(data) {
- alert( data );
- }).fail(function(data) {
- console.log("fail");
- console.log(data);
- });
- router.post('/login', passport.authenticate('local'),function(req,res){
- res.send("success");
- });
- passport.use(new LocalStrategy(
- {passReqToCallback: true},
- function(req,username, password, done) {
- //console.log(req);
- if(username=="adisak"){
- return done(null,{adisak:"hi"});
- }
- return done(null,false);
- }
- ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement