Skip to content
Permalink
Browse files

4.2.passport 자격확인 2

  • Loading branch information...
egoing committed Jul 31, 2018
1 parent 2203be6 commit 4e0d07ab23edfa0ea4adfd3d0056a4d1918f5a49
Showing with 19 additions and 22 deletions.
  1. +19 −16 main.js
  2. +0 −6 routes/auth.js
35 main.js
@@ -21,6 +21,12 @@ app.use(session({
store: new FileStore()
}))

var authData = {
email: 'egoing777@gmail.com',
password: '111111',
nickname: 'egoing'
};

var passport = require('passport'),
LocalStrategy = require('passport-local').Strategy;

@@ -31,26 +37,23 @@ passport.use(new LocalStrategy(
},
function (username, password, done) {
console.log('LocalStrategy', username, password);
/*
User.findOne({
username: username
}, function (err, user) {
if (err) {
return done(err);
}
if (!user) {
return done(null, false, {
message: 'Incorrect username.'
});
}
if (!user.validPassword(password)) {
if(username === authData.email){
console.log(1);
if(password === authData.password){
console.log(2);
return done(null, authData);
} else {
console.log(3);
return done(null, false, {
message: 'Incorrect password.'
});
}
return done(null, user);
});
*/
} else {
console.log(4);
return done(null, false, {
message: 'Incorrect username.'
});
}
}
));

@@ -5,12 +5,6 @@ var fs = require('fs');
var sanitizeHtml = require('sanitize-html');
var template = require('../lib/template.js');

var authData = {
email: 'egoing777@gmail.com',
password: '111111',
nickname: 'egoing'
}

router.get('/login', function (request, response) {
var title = 'WEB - login';
var list = template.list(request.list);

0 comments on commit 4e0d07a

Please sign in to comment.
You can’t perform that action at this time.