<commit_before>var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
var passport = require('passport');
var mongoose = require('mongoose');
var auth = require('./middlewares/authorization');
var controllerIndex = require('./controllers/index');
var controllerUser = require('./controllers/user');
var controllerPost = require('./controllers/post');

mongoose.connect('mongodb://localhost/blog');

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'hjs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

require('./config/passport')(passport);


app.get('/', controllerIndex.index);
app.get('/signin', controllerUser.signin);
app.post('/signin', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/signin'}));
app.get('/signup', controllerUser.getSignup);
app.post('/signup', controllerUser.postSignup);
app.get('/post/create', auth.requiresLogin, controllerPost.createPostPage);
app.post('/post/create', auth.requiresLogin, controllerPost.createPost);
app.get('/post/:id', controllerPost.read);
app.get('/post/:id/edit', controllerPost.edit);
app.post('/post/:id/edit', auth.requiresLogin, controllerPost.editPost);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});<commit_msg>Correct authentication requirement for posts creation and edit<commit_after>var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
var passport = require('passport');
var mongoose = require('mongoose');
var auth = require('./middlewares/authorization');
var controllerIndex = require('./controllers/index');
var controllerUser = require('./controllers/user');
var controllerPost = require('./controllers/post');

mongoose.connect('mongodb://localhost/blog');

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'hjs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));

// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

require('./config/passport')(passport);


app.get('/', controllerIndex.index);
app.get('/signin', controllerUser.signin);
app.post('/signin', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/signin'}));
app.get('/signup', controllerUser.getSignup);
app.post('/signup', controllerUser.postSignup);
app.get('/post/create', auth.requiresLogin, controllerPost.createPostPage);
app.post('/post/create', auth.requiresLogin, controllerPost.createPost);
app.get('/post/:id/edit', auth.requiresLogin, controllerPost.edit);
app.post('/post/:id/edit', auth.requiresLogin, controllerPost.editPost);
app.get('/post/:id', controllerPost.read);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});
{'fraction_non_alphanumeric': 0.20482254131671634, 'fraction_numerical': 0.002167434299647792, 'mean_word_length': 6.92274678111588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '686907', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1102, 'n_words': 200}