import passport from 'passport';
import passportLocal from 'passport-local';
import user from '../models';

const LocalStrategy = passportLocal.Strategy;

passport.serializeUser((sessionUser, done) => {
  done(null, sessionUser.id);
});

passport.deserializeUser((id, done) => {
  User.findById(id, (err, sessionUser) => done(err, sessionUser));
});


passport.use(new LocalStrategy({ passReqToCallback: true }, (req, username, password, done) => {
  user.User.findOne({
    where: {
      username
    }
  }).then((users, err) => {
    if (!users) {
      return done(null, false, { message: 'Incorrect username' });
    }
    if (users.password !== req.body.password) {
      return done(null, false, { message: ' Incorrect password.' });
    }
    return done(null, users);
  }).catch(err => done(err));
}
));

module.exports = passport;


@@ -344,17 +344,16 @@
 );%0A%7D);%0A%0A
-%0A
 passport
@@ -517,13 +517,8 @@
 sers
-, err
 ) =%3E

Remove eslint error flags