1
0
Fork 0

Adding register.pug and register route

This commit is contained in:
KEZEL BENOIT p1907091 2020-11-03 08:24:17 +01:00
parent 5d2fba4d69
commit 09a9d16ae7
11 changed files with 173 additions and 115 deletions

2
app.js
View file

@ -12,6 +12,7 @@ const loginRouter = require("./routes/login");
const edtRouter = require("./routes/edt"); const edtRouter = require("./routes/edt");
const homeRouter = require("./routes/home"); const homeRouter = require("./routes/home");
const marksRouter = require("./routes/marks"); const marksRouter = require("./routes/marks");
const registerRouter = require("./routes/register");
let app = express(); let app = express();
const sessionMiddleware = session({ const sessionMiddleware = session({
@ -47,6 +48,7 @@ app.use("/email", require("./routes/email"));
app.use("/edt", edtRouter); app.use("/edt", edtRouter);
app.use("/home", homeRouter); app.use("/home", homeRouter);
app.use("/marks", marksRouter); app.use("/marks", marksRouter);
app.use('/register', registerRouter);
// catch 404 and forward to error handler // catch 404 and forward to error handler
app.use((req, res) => { app.use((req, res) => {

10
package-lock.json generated
View file

@ -1055,11 +1055,11 @@
"cookie": "0.4.0", "cookie": "0.4.0",
"cookie-signature": "1.0.6", "cookie-signature": "1.0.6",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "2.0.0", "depd": "~2.0.0",
"on-headers": "1.0.2", "on-headers": "~1.0.2",
"parseurl": "1.3.3", "parseurl": "~1.3.3",
"safe-buffer": "5.2.0", "safe-buffer": "5.2.0",
"uid-safe": "2.1.5" "uid-safe": "~2.1.5"
}, },
"dependencies": { "dependencies": {
"depd": { "depd": {
@ -3668,7 +3668,7 @@
"resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz",
"integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",
"requires": { "requires": {
"random-bytes": "1.0.0" "random-bytes": "~1.0.0"
} }
}, },
"umzug": { "umzug": {

View file

@ -17,6 +17,20 @@ h2 {
#signin, #signup, #forgotPsw { #signin, #signup, #forgotPsw {
padding: 4vw; } padding: 4vw; }
.notregister, .alreadyregister {
border: none;
color: #0099ff;
background-color: transparent;
font-size: 20px;
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 20px;
cursor: pointer; }
.invisible {
display: none; }
.signinup { .signinup {
margin-top: 15vh; margin-top: 15vh;
background-color: #2a2a2a; background-color: #2a2a2a;
@ -34,7 +48,7 @@ h2 {
width: 40%; width: 40%;
display: block; display: block;
margin: auto; margin: auto;
font-size: 35px; font-size: 25px;
border: 2px solid #2C3531; border: 2px solid #2C3531;
cursor: pointer; cursor: pointer;
transition-duration: 0.3s; } transition-duration: 0.3s; }

File diff suppressed because one or more lines are too long

View file

@ -27,6 +27,20 @@ h2
#signin, #signup, #forgotPsw #signin, #signup, #forgotPsw
padding: 4vw; padding: 4vw;
.notregister, .alreadyregister
border: none;
color: $secondary;
background-color: transparent;
font-size: 20px;
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 20px;
cursor: pointer;
.invisible
display: none;
.signinup .signinup
margin-top: 15vh; margin-top: 15vh;
background-color: $dark2; background-color: $dark2;
@ -45,7 +59,7 @@ h2
width: 40%; width: 40%;
display: block; display: block;
margin: auto; margin: auto;
font-size: 35px; font-size: 25px;
border: 2px solid #2C3531; border: 2px solid #2C3531;
cursor: pointer; cursor: pointer;
transition-duration: 0.3s transition-duration: 0.3s

8
routes/register.js Normal file
View file

@ -0,0 +1,8 @@
let express = require("express");
let router = express.Router();
router.get("/", (req, res) => {
res.render("register", { title: "L'ETU" });
});
module.exports = router;

View file

@ -1,6 +1,6 @@
extends index extends layout
block home block content
h1(id="welcome") Welcome Back Benoit ! h1(id="welcome") Welcome Back Benoit !
div(class="row home") div(class="row home")
if admin === false if admin === false

View file

@ -1,11 +1,6 @@
extends layout extends layout
block content block navbar
- var student = true
- var teacher = false
- var admin = false
div(class="row" id="page")
div(class="col s2" id="panel")
if student === true if student === true
div(id="navprofile" class="student") div(id="navprofile" class="student")
p Kezel Benoit p Kezel Benoit
@ -56,5 +51,3 @@ block content
li li
a Gestion des profils a Gestion des profils
div(class="col s10" id="main")
include marks.pug

View file

@ -7,5 +7,12 @@ html
link(rel="stylesheet", href="/stylesheets/style.css") link(rel="stylesheet", href="/stylesheets/style.css")
script(src="/socket.io/socket.io.js") script(src="/socket.io/socket.io.js")
body body
- var student = true
- var teacher = false
- var admin = false
div(class="row" id="page")
div(class="col s2" id="panel")
block navbar
div(class="col s10" id="main")
block content block content
script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js") script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js")

View file

@ -1,6 +1,12 @@
extends layout doctype html
html
block content head
title= title
link(href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet")
link(rel="stylesheet", href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css")
link(rel="stylesheet", href="/stylesheets/style.css")
script(src="/socket.io/socket.io.js")
body
div(class='row main-form') div(class='row main-form')
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signin") div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signin")
h2 Welcome back h2 Welcome back
@ -16,32 +22,11 @@ block content
label(for="password-input") Password label(for="password-input") Password
input(type='submit' value='Login') input(type='submit' value='Login')
button(class="notregister") Not registered ?
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signup")
h2 Welcome
form#register
div(class="input-field col s6")
i(class="material-icons prefix") portrait
input(type="text" id="firstname-input" class="autocomplete")
label(for="firstname-input") First Name
div(class="input-field col s6")
input(type="text" id="lastname-input" class="autocomplete")
label(for="lastname-input") Last Name
div(class="input-field col s12") div(class='col s12 m8 offset-m2 signinup z-depth-5 invisible' id="forgotPsw")
i(class="material-icons prefix") mail
input(type="text" id="mailreg-input" class="autocomplete")
label(for="mailreg-input") Email
div(class="input-field col s12")
i(class="material-icons prefix") lock
input(type="password" id="passwordreg-input" class="autocomplete")
label(for="passwordreg-input") Password
input(type='submit' value='Register')
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="forgotPsw")
h2 Forgot password h2 Forgot password
form form
div(class="input-field col s12") div(class="input-field col s12")
@ -53,3 +38,4 @@ block content
script(src="/javascripts/login.js") script(src="/javascripts/login.js")
script(src="/javascripts/register.js") script(src="/javascripts/register.js")
script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js")

34
views/register.pug Normal file
View file

@ -0,0 +1,34 @@
doctype html
html
head
title= title
link(href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet")
link(rel="stylesheet", href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css")
link(rel="stylesheet", href="/stylesheets/style.css")
script(src="/socket.io/socket.io.js")
body
div(class='row main-form')
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signup")
h2 Welcome
form#register
div(class="input-field col s6")
i(class="material-icons prefix") portrait
input(type="text" id="firstname-input" class="autocomplete")
label(for="firstname-input") First Name
div(class="input-field col s6")
input(type="text" id="lastname-input" class="autocomplete")
label(for="lastname-input") Last Name
div(class="input-field col s12")
i(class="material-icons prefix") mail
input(type="text" id="mailreg-input" class="autocomplete")
label(for="mailreg-input") Email
div(class="input-field col s12")
i(class="material-icons prefix") lock
input(type="password" id="passwordreg-input" class="autocomplete")
label(for="passwordreg-input") Password
input(type='submit' value='Register')
button(class="alreadyregister") Already registered ?