Permalink
Browse files

lint rules fixes

  • Loading branch information...
1 parent c3f54ab commit 2b2fbbf8c36b4e62607dafb2ff96e033e049a08e @ancasicolica ancasicolica committed Jun 7, 2016
Showing with 39 additions and 66 deletions.
  1. +2 −29 app.js
  2. +26 −25 config/passport.js
  3. +11 −11 config/routes.js
  4. +0 −1 package.json
View
@@ -1,12 +1,11 @@
const express = require('express');
const http = require('http');
const path = require('path');
-const passport = require("passport");
+const passport = require('passport');
const morgan = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const session = require('express-session');
-const methodOverride = require('method-override');
const errorhandler = require('errorhandler');
var env = process.env.NODE_ENV || 'development';
@@ -16,7 +15,6 @@ console.log('Using configuration', config);
require('./config/passport')(passport, config);
-
var app = express();
app.set('port', config.app.port);
@@ -34,35 +32,10 @@ app.use(session(
}));
app.use(passport.initialize());
app.use(passport.session());
-app.use(methodOverride());
app.use(express.static(path.join(__dirname, 'public')));
-
-app.use(function (err, req, res, next) {
- res.status(err.status || 500);
- res.render('500', {error: err});
-});
-/*
-app.use(function (req, res, next) {
- res.status(404);
- if (req.accepts('html')) {
- res.render('404',
- {
- url: req.url
- });
- return;
- }
- if (req.accepts('json')) {
- res.send({error: 'Not found'});
- return;
- }
- res.type('txt').send('Not found');
-});
-*/
-
require('./config/routes')(app, config, passport);
-
app.listen(app.get('port'), function () {
- console.log("Express server listening on port " + app.get('port'));
+ console.log('Express server listening on port ' + app.get('port'));
});
View
@@ -1,31 +1,32 @@
-var SamlStrategy = require('passport-saml').Strategy
+const SamlStrategy = require('passport-saml').Strategy;
module.exports = function (passport, config) {
- passport.serializeUser(function(user, done) {
- done(null, user);
- });
+ passport.serializeUser(function (user, done) {
+ done(null, user);
+ });
- passport.deserializeUser(function(user, done) {
- done(null, user);
- });
+ passport.deserializeUser(function (user, done) {
+ done(null, user);
+ });
- passport.use(new SamlStrategy(
- {
- path: config.passport.saml.path,
- entryPoint: config.passport.saml.entryPoint,
- issuer: config.passport.saml.issuer
- },
- function(profile, done) {
- return done(null,
- {
- id : profile.uid,
- email : profile.email,
- displayName : profile.cn,
- firstName : profile.givenName,
- lastName : profile.sn
- });
- })
- );
+ passport.use(new SamlStrategy(
+ {
+ path: config.passport.saml.path,
+ entryPoint: config.passport.saml.entryPoint,
+ issuer: config.passport.saml.issuer,
+ cert: config.passport.saml.cert
+ },
+ function (profile, done) {
+ return done(null,
+ {
+ id: profile.uid,
+ email: profile.email,
+ displayName: profile.cn,
+ firstName: profile.givenName,
+ lastName: profile.sn
+ });
+ })
+ );
-}
+};
View
@@ -1,25 +1,25 @@
module.exports = function (app, config, passport) {
- app.get("/", function (req, res) {
+ app.get('/', function (req, res) {
if (req.isAuthenticated()) {
- res.render("home",
+ res.render('home',
{
user: req.user
});
} else {
- res.render("home",
+ res.render('home',
{
user: null
});
}
});
- app.get("/login",
+ app.get('/login',
passport.authenticate(config.passport.strategy,
{
- successRedirect: "/",
- failureRedirect: "/login",
+ successRedirect: '/',
+ failureRedirect: '/login'
})
);
@@ -34,18 +34,18 @@ module.exports = function (app, config, passport) {
}
);
- app.get("/signup", function (req, res) {
- res.render("signup");
+ app.get('/signup', function (req, res) {
+ res.render('signup');
});
- app.get("/profile", function (req, res) {
+ app.get('/profile', function (req, res) {
if (req.isAuthenticated()) {
- res.render("profile",
+ res.render('profile',
{
user: req.user
});
} else {
- res.redirect("/login");
+ res.redirect('/login');
}
});
View
@@ -33,7 +33,6 @@
"express": "4.13.4",
"express-session": "1.13.0",
"jade": "1.11.0",
- "method-override": "2.3.6",
"morgan": "1.7.0",
"nodemon": "1.9.2",
"passport": "0.3.2",

0 comments on commit 2b2fbbf

Please sign in to comment.