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