<%= page.title %>
- <% if ( errorCode && errorCode === 404 ) { %> - - <% } %> -- <%= page.error %> -
-diff --git a/package.json b/package.json index d049d8e..6d70680 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "connect-flash": "^0.1.1", "connect-mongo": "^4.6.0", "cookie-parser": "^1.4.6", + "debug": "^4.3.3", "ejs": "^3.1.6", "express": "^4.17.2", "express-session": "^1.17.2", diff --git a/src/app.js b/src/app.js index 0ca0bf5..50c4eeb 100644 --- a/src/app.js +++ b/src/app.js @@ -50,10 +50,8 @@ if (["production"].indexOf(env) !== -1) { /* eslint-disable func-names */ app.use((req, res, next) => { if (req.secure) { - // request was via https, so do no special handling next(); } else { - // request was via http, so redirect to https res.redirect(`https://${req.headers.host}${req.url}`); } }); diff --git a/src/bin/www.js b/src/bin/www.js index 1723d8a..3fc7b77 100644 --- a/src/bin/www.js +++ b/src/bin/www.js @@ -4,54 +4,49 @@ * Module dependencies. */ -import app from '../app'; -import debugLib from 'debug'; -import http from 'http'; -import {port} from '../config'; +import debugLib from "debug"; +import http from "http"; +import app from "../app"; +import { port } from "../config"; -const debug = debugLib('nodecdtheque:server'); +const debug = debugLib("nodecdtheque:server"); const server = http.createServer(app); -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - /** * Event listener for HTTP server "error" event. * @param {*} error */ function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } + if (error.syscall !== "listen") { + throw error; + } - const bind = typeof port === 'string' ? - 'Pipe ' + port : - 'Port ' + port; + const bind = typeof port === "string" ? `Pipe ${port}` : `Port ${port}`; - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } + switch (error.code) { + case "EACCES": + console.error(`${bind} requires elevated privileges`); + process.exit(1); + break; + case "EADDRINUSE": + console.error(`${bind} is already in use`); + process.exit(1); + break; + default: + throw error; + } } /** * Event listener for HTTP server "listening" event. */ function onListening() { - const addr = server.address(); - const bind = typeof addr === 'string' ? - 'pipe ' + addr : - 'port ' + addr.port; - debug('Listening on ' + bind); + const addr = server.address(); + const bind = + typeof addr === "string" ? `pipe ${addr}` : `port ${addr.port}`; + debug(`Listening on ${bind}`); } +server.listen(port); +server.on("error", onError); +server.on("listening", onListening); diff --git a/src/views/error.ejs b/src/views/error.ejs index d2057dd..5c36b8a 100644 --- a/src/views/error.ejs +++ b/src/views/error.ejs @@ -1,23 +1,22 @@ -<%- include('partials/head', {page: page, user: user}); %> - -
- <%- include('partials/header'); %> -- <%= page.error %> -
-+ <%= page.error %> +
+Inscription
+Inscription
- - -Déjà inscrit ? - Connectez-vous -
-