Fix logout adn dynamic permission view
This commit is contained in:
parent
c8e156dc72
commit
a9643c7feb
13 changed files with 38 additions and 50 deletions
|
@ -1,4 +1,3 @@
|
||||||
const socket = io.connect();
|
|
||||||
const date = document.getElementById("date");
|
const date = document.getElementById("date");
|
||||||
const details = document.getElementById("details");
|
const details = document.getElementById("details");
|
||||||
const marksdetailsbackground = document.getElementById("marksdetailsbackground");
|
const marksdetailsbackground = document.getElementById("marksdetailsbackground");
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
const socket = io.connect();
|
|
||||||
|
|
||||||
socket.on("agendaGet", data => {
|
socket.on("agendaGet", data => {
|
||||||
document.querySelectorAll(".eventName, .eventLocation").forEach(p => p.innerHTML = "");
|
document.querySelectorAll(".eventName, .eventLocation").forEach(p => p.innerHTML = "");
|
||||||
data.forEach(event => {
|
data.forEach(event => {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
let socket = io.connect();
|
|
||||||
|
|
||||||
document.getElementById("login").addEventListener("submit", e=>{
|
document.getElementById("login").addEventListener("submit", e=>{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let expressionReguliere = /^(([^<>()[]\.,;:s@]+(.[^<>()[]\.,;:s@]+)*)|(.+))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
|
let expressionReguliere = /^(([^<>()[]\.,;:s@]+(.[^<>()[]\.,;:s@]+)*)|(.+))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
let socket = io.connect();
|
const socket = io.connect();
|
||||||
/*
|
/*
|
||||||
Front-end Event
|
Front-end Event
|
||||||
*/
|
*/
|
||||||
// Disconnect
|
// Disconnect
|
||||||
document.getElementById("logout").addEventListener("click", function() {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
socket.emit("logout")
|
const logout = document.getElementById("logout");
|
||||||
|
if (logout)
|
||||||
|
logout.addEventListener("click", () => socket.emit("logout"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
const socket = io.connect();
|
|
||||||
const marks = document.getElementById("marksrow");
|
const marks = document.getElementById("marksrow");
|
||||||
const evaluationTemplate = marks.querySelector("#evaluationTemplate");
|
const evaluationTemplate = marks.querySelector("#evaluationTemplate");
|
||||||
const gradeTemplate = marks.querySelector("#gradeTemplate");
|
const gradeTemplate = marks.querySelector("#gradeTemplate");
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
const socket = io.connect();
|
|
||||||
const group = document.getElementById("group");
|
const group = document.getElementById("group");
|
||||||
const evaluation = document.getElementById("evaluation");
|
const evaluation = document.getElementById("evaluation");
|
||||||
const marksform = document.getElementById("marksform");
|
const marksform = document.getElementById("marksform");
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
let socket = io.connect();
|
|
||||||
|
|
||||||
document.getElementById("editprofil").addEventListener("submit", e=>{
|
document.getElementById("editprofil").addEventListener("submit", e=>{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
socket.emit("profileEdit", {
|
socket.emit("profileEdit", {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
let socket = io.connect();
|
|
||||||
|
|
||||||
document.getElementById("register").addEventListener("submit", e=>{
|
document.getElementById("register").addEventListener("submit", e=>{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let expressionReguliere = /^(([^<>()[]\.,;:s@]+(.[^<>()[]\.,;:s@]+)*)|(.+))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
|
let expressionReguliere = /^(([^<>()[]\.,;:s@]+(.[^<>()[]\.,;:s@]+)*)|(.+))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
|
||||||
|
|
|
@ -247,11 +247,11 @@ h3
|
||||||
div:nth-child(3)
|
div:nth-child(3)
|
||||||
text-align: left
|
text-align: left
|
||||||
|
|
||||||
|
|
||||||
#marksrow
|
#marksrow
|
||||||
padding: 20px 70px
|
padding: 20px 70px
|
||||||
|
|
||||||
|
#logout, #logout>a
|
||||||
|
cursor: pointer
|
||||||
|
|
||||||
#marksdetails, #details
|
#marksdetails, #details
|
||||||
z-index: 100001
|
z-index: 100001
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
doctype html
|
extends ../template/layout
|
||||||
html
|
|
||||||
head
|
block content
|
||||||
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
|
||||||
|
@ -37,4 +31,3 @@ html
|
||||||
input(type='submit' value='Send email')
|
input(type='submit' value='Send email')
|
||||||
|
|
||||||
script(src="/javascripts/login.js")
|
script(src="/javascripts/login.js")
|
||||||
script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js")
|
|
|
@ -1,12 +1,6 @@
|
||||||
doctype html
|
extends ../template/layout
|
||||||
html
|
|
||||||
head
|
block content
|
||||||
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="signup")
|
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signup")
|
||||||
h2 Welcome
|
h2 Welcome
|
||||||
|
@ -34,4 +28,3 @@ html
|
||||||
a(class="alreadyregister" href="login") Already registered ?
|
a(class="alreadyregister" href="login") Already registered ?
|
||||||
|
|
||||||
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")
|
|
|
@ -14,15 +14,26 @@ html
|
||||||
meta(name="msapplication-TileColor" content="#da532c")
|
meta(name="msapplication-TileColor" content="#da532c")
|
||||||
meta(name="theme-color" content="#ffffff")
|
meta(name="theme-color" content="#ffffff")
|
||||||
script(src="/socket.io/socket.io.js")
|
script(src="/socket.io/socket.io.js")
|
||||||
|
script(src="/javascripts/main.js")
|
||||||
body
|
body
|
||||||
- var student = false;
|
-
|
||||||
- var teacher = true;
|
var student = false, teacher = false, admin = false;
|
||||||
- var admin = false;
|
if (session.user) {
|
||||||
|
switch (session.user.permissions) {
|
||||||
|
case 1:
|
||||||
|
student = true;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
teacher = true;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
admin = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
div(class="row" id="page")
|
div(class="row" id="page")
|
||||||
block navbar
|
block navbar
|
||||||
div(class="col s12" id="main")
|
div(class="col s12" id="main")
|
||||||
block content
|
block content
|
||||||
script(src="/javascripts/main.js")
|
|
||||||
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")
|
||||||
script.
|
script.
|
||||||
M.AutoInit();
|
M.AutoInit();
|
||||||
|
|
|
@ -2,7 +2,7 @@ extends layout
|
||||||
|
|
||||||
block navbar
|
block navbar
|
||||||
ul#slide-out.sidenav
|
ul#slide-out.sidenav
|
||||||
if session.user.permissions === 1
|
if student
|
||||||
li
|
li
|
||||||
.user-view.student
|
.user-view.student
|
||||||
p
|
p
|
||||||
|
@ -12,8 +12,8 @@ block navbar
|
||||||
span.white-text.name=session.user.Groups[session.user.Groups.length-1].displayName
|
span.white-text.name=session.user.Groups[session.user.Groups.length-1].displayName
|
||||||
p
|
p
|
||||||
span.white-text.email=session.user.email
|
span.white-text.email=session.user.email
|
||||||
a
|
a#logout
|
||||||
span.white-text Se déconnecter
|
span.white-text Logout
|
||||||
|
|
||||||
li
|
li
|
||||||
a(href="/" class="waves-effect") Home
|
a(href="/" class="waves-effect") Home
|
||||||
|
@ -28,15 +28,15 @@ block navbar
|
||||||
li
|
li
|
||||||
a(href="/viescol" class="waves-effect") School and student life
|
a(href="/viescol" class="waves-effect") School and student life
|
||||||
|
|
||||||
if session.user.permissions === 2
|
else if teacher
|
||||||
li
|
li
|
||||||
.user-view.teacher
|
.user-view.teacher
|
||||||
p(href='#name')
|
p(href='#name')
|
||||||
span.white-text.name=session.user.firstName + " " + session.user.lastName
|
span.white-text.name=session.user.firstName + " " + session.user.lastName
|
||||||
p(href='#email')
|
p(href='#email')
|
||||||
span.white-text.email=session.user.email
|
span.white-text.email=session.user.email
|
||||||
a
|
a#logout
|
||||||
span.white-text Se déconnecter
|
span.white-text Logout
|
||||||
li
|
li
|
||||||
a(href="/" class="waves-effect") Home
|
a(href="/" class="waves-effect") Home
|
||||||
li
|
li
|
||||||
|
@ -50,15 +50,15 @@ block navbar
|
||||||
li
|
li
|
||||||
a(href="/viescol" class="waves-effect") School and student life
|
a(href="/viescol" class="waves-effect") School and student life
|
||||||
|
|
||||||
if session.user.permissions === 3
|
else if admin
|
||||||
li
|
li
|
||||||
.user-view.admin
|
.user-view.admin
|
||||||
p(href='#name')
|
p(href='#name')
|
||||||
span.white-text.name=session.user.firstName + " " + session.user.lastName
|
span.white-text.name=session.user.firstName + " " + session.user.lastName
|
||||||
p(href='#email')
|
p(href='#email')
|
||||||
span.white-text.email=session.user.email
|
span.white-text.email=session.user.email
|
||||||
a
|
a#logout
|
||||||
span.white-text Se déconnecter
|
span.white-text Logout
|
||||||
li
|
li
|
||||||
a(href="/" class="waves-effect") Home
|
a(href="/" class="waves-effect") Home
|
||||||
li(class="active")
|
li(class="active")
|
||||||
|
|
Reference in a new issue