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,60 +1,53 @@
extends layout extends layout
block content block navbar
- var student = true if student === true
- var teacher = false div(id="navprofile" class="student")
- var admin = false p Kezel Benoit
div(class="row" id="page") p G4S3
div(class="col s2" id="panel") a Logout
if teacher === true
div(id="navprofile" class="teacher")
p Kezel Benoit
a Logout
if admin === true
div(id="navprofile" class="admin")
p Kezel Benoit
a Logout
div(id="navtop")
ul
if student === true if student === true
div(id="navprofile" class="student") li
p Kezel Benoit a Home
p G4S3 li(class="active")
a Logout a Planning
li
a Marks
li
a(href="https://mail.univ-lyon1.fr/owa/") Mail
li
a(href="https://clarolineconnect.univ-lyon1.fr/") Claroline
li
a School and student life
if teacher === true if teacher === true
div(id="navprofile" class="teacher") li
p Kezel Benoit a Home
a Logout li(class="active")
a Planning
li
a Marks
li
a(href="https://mail.univ-lyon1.fr/owa/") Mail
li
a(href="https://clarolineconnect.univ-lyon1.fr/") Claroline
if admin === true if admin === true
div(id="navprofile" class="admin") li(class="active")
p Kezel Benoit a Accueil
a Logout li
a Notes
li
a Vie scolaire et étudiante
li
a Gestion des profils
div(id="navtop")
ul
if student === true
li
a Home
li(class="active")
a Planning
li
a Marks
li
a(href="https://mail.univ-lyon1.fr/owa/") Mail
li
a(href="https://clarolineconnect.univ-lyon1.fr/") Claroline
li
a School and student life
if teacher === true
li
a Home
li(class="active")
a Planning
li
a Marks
li
a(href="https://mail.univ-lyon1.fr/owa/") Mail
li
a(href="https://clarolineconnect.univ-lyon1.fr/") Claroline
if admin === true
li(class="active")
a Accueil
li
a Notes
li
a Vie scolaire et étudiante
li
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
block content - 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
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,55 +1,41 @@
extends layout 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="signin")
h2 Welcome back
form#login
div(class="input-field col s12")
i(class="material-icons prefix") mail
input(type="text" id="mail-input" class="autocomplete")
label(for="mail-input") Email
block content div(class="input-field col s12")
div(class='row main-form') i(class="material-icons prefix") lock
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signin") input(type="password" id="password-input" class="autocomplete")
h2 Welcome back label(for="password-input") Password
form#login
input(type='submit' value='Login')
button(class="notregister") Not registered ?
div(class='col s12 m8 offset-m2 signinup z-depth-5 invisible' id="forgotPsw")
h2 Forgot password
form
div(class="input-field col s12") div(class="input-field col s12")
i(class="material-icons prefix") mail i(class="material-icons prefix") mail
input(type="text" id="mail-input" class="autocomplete") input(type="text" id="mailforgot-input" class="autocomplete")
label(for="mail-input") Email label(for="mailforgot-input") Email
div(class="input-field col s12") input(type='submit' value='Send email')
i(class="material-icons prefix") lock
input(type="password" id="password-input" class="autocomplete")
label(for="password-input") Password
input(type='submit' value='Login') script(src="/javascripts/login.js")
script(src="/javascripts/register.js")
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signup") script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js")
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')
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="forgotPsw")
h2 Forgot password
form
div(class="input-field col s12")
i(class="material-icons prefix") mail
input(type="text" id="mailforgot-input" class="autocomplete")
label(for="mailforgot-input") Email
input(type='submit' value='Send email')
script(src="/javascripts/login.js")
script(src="/javascripts/register.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 ?