diff --git a/.gitignore b/.gitignore
index f084434..e607017 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,7 @@
# Floobits stuff
.floo
.flooignore
+
+# npm packages
+package-lock.json
+node_modules
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..283c7ba
--- /dev/null
+++ b/app.js
@@ -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);
diff --git a/index.html b/index.html
deleted file mode 100644
index 515eef5..0000000
--- a/index.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
- Internet security
-
-
-
-
-
Do you really think you're safe on the web ?
-
-
-
-
-
-
Do you really think your passwords are safe?
-
-
-
-
-
-
To make your life easier, use a password manager !
-
-
-
-
-
For more security, the 2AF should be used as much as possible
-
It's one of the best protection you can get !
-
-
-
-
-
Pay attention to the cookie on the sites!
- Don't accept them for nothing
- Cookie :
- Before : Formerly a sweet little cake, which was accepted with pleasure.
- Today: a small, salty computer file, which must be vehemently refused
-
-
-
-
-
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..f235520
--- /dev/null
+++ b/package.json
@@ -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 ",
+ "license": "ISC",
+ "dependencies": {
+ "express": "^4.17.1",
+ "morgan": "^1.10.0",
+ "pug": "^2.0.4"
+ }
+}
diff --git a/assets/css/main.css b/public/css/main.css
similarity index 76%
rename from assets/css/main.css
rename to public/css/main.css
index b92606f..69dd262 100644
--- a/assets/css/main.css
+++ b/public/css/main.css
@@ -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;
diff --git a/assets/js/main.js b/public/js/main.js
similarity index 84%
rename from assets/js/main.js
rename to public/js/main.js
index 2cd1cdf..8387661 100644
--- a/assets/js/main.js
+++ b/public/js/main.js
@@ -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;
+}
+
diff --git a/routes/error.js b/routes/error.js
new file mode 100644
index 0000000..0f70fdd
--- /dev/null
+++ b/routes/error.js
@@ -0,0 +1,6 @@
+module.exports = (err, req, res, next) => {
+ console.error(err.stack);
+ res.status(500);
+ res.render("error", {session: req.session});
+}
+
diff --git a/routes/index.js b/routes/index.js
new file mode 100644
index 0000000..a6d8e5d
--- /dev/null
+++ b/routes/index.js
@@ -0,0 +1,9 @@
+let router = require("express").Router();
+
+
+router.get("/", (req, res) => {
+ res.render("index");
+});
+
+
+module.exports = router;
diff --git a/routes/notFound.js b/routes/notFound.js
new file mode 100644
index 0000000..47bb630
--- /dev/null
+++ b/routes/notFound.js
@@ -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
+
diff --git a/views/404.pug b/views/404.pug
new file mode 100644
index 0000000..c06d7fc
--- /dev/null
+++ b/views/404.pug
@@ -0,0 +1,5 @@
+extend layout
+block content
+ h1 404 - Page not found
+ p The requested URL #{url} was not found on this server
+
diff --git a/views/error.pug b/views/error.pug
new file mode 100644
index 0000000..d00ecb8
--- /dev/null
+++ b/views/error.pug
@@ -0,0 +1,5 @@
+extend layout
+block content
+ h1 500 - Internal error
+ p Sorry an unexpected error occurred internally
+
diff --git a/views/index.pug b/views/index.pug
new file mode 100644
index 0000000..4d01f38
--- /dev/null
+++ b/views/index.pug
@@ -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")
diff --git a/views/layout.pug b/views/layout.pug
new file mode 100644
index 0000000..b9b4ca2
--- /dev/null
+++ b/views/layout.pug
@@ -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
+