Setup NodeJS
This commit is contained in:
parent
c5b720bf63
commit
179a20d507
13 changed files with 168 additions and 53 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -4,3 +4,7 @@
|
|||
# Floobits stuff
|
||||
.floo
|
||||
.flooignore
|
||||
|
||||
# npm packages
|
||||
package-lock.json
|
||||
node_modules
|
||||
|
|
17
app.js
Normal file
17
app.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
let express = require("express");
|
||||
let morgan = require("morgan");
|
||||
|
||||
let indexRoute = require("./routes/index");
|
||||
let notFoundRoute = require("./routes/notFound");
|
||||
let errorRoute = require("./routes/error");
|
||||
|
||||
let app = express();
|
||||
|
||||
|
||||
app.use(morgan("dev"))
|
||||
.use(express.static("public"))
|
||||
.set("view engine", "pug")
|
||||
.use("/", indexRoute)
|
||||
.use(notFoundRoute)
|
||||
.use(errorRoute)
|
||||
.listen(process.env.PORT || 8080);
|
53
index.html
53
index.html
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Internet security</title>
|
||||
<link rel="stylesheet" type="text/css" href="assets/css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" id="main">
|
||||
<h1>Do you really think you're safe on the web ?</h1>
|
||||
<label for="email">Let's begin by check if your email is safe ;)</label>
|
||||
<input type="email" id="email" name="email" placeholder="example : xyz@gmail.com">
|
||||
</div>
|
||||
<div class="container hide" id="result_mail">
|
||||
<h1>Results</h1>
|
||||
<h2></h2> <!-- Your email isn't safe ! OR Your email is safe ! -->
|
||||
<h2>Let's see what about your <a href="#password_test">passwords ?</a></h2>
|
||||
</div>
|
||||
<div class="container hide" id="password_test">
|
||||
<h1>Do you really think your passwords are safe?</h1>
|
||||
<label for="password">Let's see if your password is secure</label>
|
||||
<input type="password" id="password" name="password" placeholder="your password: MDPdrive2">
|
||||
</div>
|
||||
<div class="container hide" id="result_password">
|
||||
<h1>Results</h1>
|
||||
<h2></h2><!-- your password isn't safe ! | you password is safe -->
|
||||
<!-- use https://password.kaspersky.com/ -->
|
||||
<ul>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container hide" id="password_manage">
|
||||
<h1>To make your life easier, use a password manager !</h1>
|
||||
<h2><a href="https://techcrunch.com/2018/12/25/cybersecurity-101-guide-password-manager/">Learn more</a></h2>
|
||||
</div>
|
||||
|
||||
<div class="container hide" id="security_2AF">
|
||||
<h1>For more security, the 2AF should be used as much as possible</h1>
|
||||
<h2>It's one of the best protection you can get !</h2>
|
||||
<h2><a href="https://fr.wikipedia.org/wiki/Double_authentification">Learn more</a></h2>
|
||||
</div>
|
||||
|
||||
<div class="container hide" id="cookie">
|
||||
<h1>Pay attention to the cookie on the sites!
|
||||
Don't accept them for nothing</h1>
|
||||
<h2 id="cookie_text">Cookie :</h2>
|
||||
<h2>Before : Formerly a sweet little cake, which was accepted with pleasure.</h2>
|
||||
<h2>Today: a small, salty computer file, which must be vehemently refused</h2>
|
||||
</div>
|
||||
|
||||
<script src="assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
20
package.json
Normal file
20
package.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "internet_security",
|
||||
"version": "1.0.0",
|
||||
"description": "Internet security awareness campaigns",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@forge.univ-lyon1.fr:p1905458/internet-security.git"
|
||||
},
|
||||
"author": "flifloo <flifloo@gmail.com>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"morgan": "^1.10.0",
|
||||
"pug": "^2.0.4"
|
||||
}
|
||||
}
|
|
@ -11,6 +11,25 @@ body{
|
|||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background: linear-gradient(-45deg, #ee7752, #23a6d5);
|
||||
background-size: 200% 200%;
|
||||
animation: gradient 15s ease infinite;
|
||||
}
|
||||
|
||||
@keyframes gradient {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.container{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
|
@ -34,7 +53,27 @@ body{
|
|||
padding: 15vh 0;
|
||||
animation: fadeup 1s;
|
||||
}
|
||||
/*
|
||||
.triangle-right {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 0px solid transparent;
|
||||
border-left: 300px solid #0a89ac;
|
||||
border-bottom: 130px solid transparent;
|
||||
float: left;
|
||||
animation : fade 0.5s;
|
||||
}
|
||||
|
||||
.trapezoid {
|
||||
border-bottom: 94px solid #e35d00;
|
||||
border-left: 100px solid transparent;
|
||||
border-right: 0px solid transparent;
|
||||
height: 0;
|
||||
width: 150px;
|
||||
float: right;
|
||||
animation : fade 0.5s;
|
||||
}
|
||||
*/
|
||||
.container h2{
|
||||
text-align: center;
|
||||
animation: fade 2s;
|
|
@ -34,3 +34,12 @@ function mailValid() {
|
|||
input.classList.add("error");
|
||||
}
|
||||
}
|
||||
|
||||
function mailCheck(mail) {
|
||||
let Http = new XMLHttpRequest();
|
||||
Http.open("GET", "https://cors-anywhere.herokuapp.com/https://haveibeenpwned.com/unifiedsearch/" + mail);
|
||||
//Http.setRequestHeader("Origin", "haveibeenpwned.com")
|
||||
Http.send();
|
||||
Http.response;
|
||||
}
|
||||
|
6
routes/error.js
Normal file
6
routes/error.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
module.exports = (err, req, res, next) => {
|
||||
console.error(err.stack);
|
||||
res.status(500);
|
||||
res.render("error", {session: req.session});
|
||||
}
|
||||
|
9
routes/index.js
Normal file
9
routes/index.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
let router = require("express").Router();
|
||||
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
res.render("index");
|
||||
});
|
||||
|
||||
|
||||
module.exports = router;
|
11
routes/notFound.js
Normal file
11
routes/notFound.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
let router = require("express").Router();
|
||||
|
||||
|
||||
router.use((req, res) => {
|
||||
res.status(404);
|
||||
res.render("404", {url: req.path, session: req.session});
|
||||
});
|
||||
|
||||
|
||||
module.exports = router
|
||||
|
5
views/404.pug
Normal file
5
views/404.pug
Normal file
|
@ -0,0 +1,5 @@
|
|||
extend layout
|
||||
block content
|
||||
h1 404 - Page not found
|
||||
p The requested URL #{url} was not found on this server
|
||||
|
5
views/error.pug
Normal file
5
views/error.pug
Normal file
|
@ -0,0 +1,5 @@
|
|||
extend layout
|
||||
block content
|
||||
h1 500 - Internal error
|
||||
p Sorry an unexpected error occurred internally
|
||||
|
31
views/index.pug
Normal file
31
views/index.pug
Normal file
|
@ -0,0 +1,31 @@
|
|||
extend layout
|
||||
block content
|
||||
div.container#main
|
||||
div.triangle-right
|
||||
h1 Do you really think you're safe on the web ?
|
||||
label(for="email") Let's begin by check if your email is safe ;)
|
||||
input(type="email" id="email" name="email" placeholder="example : xyz@gmail.com")
|
||||
div.trapezoid
|
||||
div.container.hide#result_mail
|
||||
h1 Results
|
||||
h2
|
||||
h2 Let's see what about your
|
||||
a(href="#password_test") passwords ?
|
||||
div.container.hide#password_test
|
||||
h1 Do you really think your passwords are safe ?
|
||||
label(for="password") Let's see if your password is secure
|
||||
input(type="password" id="password" name="password" placeholder="your password: MDPdrive2")
|
||||
div.container.hide#result_password
|
||||
h1 Results
|
||||
h2
|
||||
ul
|
||||
div.container.hide#password_manage
|
||||
h1 To make your life easier, use a password manager !
|
||||
h2
|
||||
a(href="https://fr.wikipedia.org/wiki/Double_authentification") Learn more
|
||||
div.container.hide#cookie
|
||||
h1 Pay attention to the cookie on the sites ! Don't accept them for nothing
|
||||
h2#cookie_text Cookie :
|
||||
h2 Before : Formerly a sweet little cake, which was accepted with pleasure.
|
||||
h2 Today: a small, salty computer file, which must be vehemently refused
|
||||
script(src="/js/main.js")
|
12
views/layout.pug
Normal file
12
views/layout.pug
Normal file
|
@ -0,0 +1,12 @@
|
|||
doctype html
|
||||
html(lang="en")
|
||||
head
|
||||
meta(charset='utf-8')
|
||||
if title
|
||||
title Internet security - #{title}
|
||||
else
|
||||
title Internet security
|
||||
link(rel="stylesheet", href="/css/main.css")
|
||||
body
|
||||
block content
|
||||
|
Reference in a new issue