1
0
Fork 0

Fix name and group display on views

This commit is contained in:
Ethanell 2020-12-14 23:00:47 +01:00
parent 4bc5d00344
commit f08e249701
2 changed files with 11 additions and 8 deletions

View file

@ -2,7 +2,7 @@ const models = require("../models");
module.exports = socket => { module.exports = socket => {
return async (data) => { return async (data) => {
let user = await models.User.findByPk(data.email); let user = await models.User.findByPk(data.email, {include: {model: models.Group, include: models.Semester}});
if (!user) if (!user)
socket.emit("login", {error: {message: "not_found"}}); socket.emit("login", {error: {message: "not_found"}});
else if (!user.checkPassword(data.password)) else if (!user.checkPassword(data.password))

View file

@ -1,18 +1,21 @@
extends layout extends layout
block navbar block navbar
if student === true if session.user.permissions === 1
div(id="navprofile" class="student" onclick="profilRedirect()") div(id="navprofile" class="student" onclick="profilRedirect()")
p Kezel Benoit p=session.user.firstName + " " + session.user.lastName
p G4S3 if session.user.Groups[session.user.Groups.length-1].number.startsWith("G")
p=session.user.Groups[session.user.Groups.length-1].number + session.user.Groups[session.user.Groups.length-1].Semester.name
else
p=session.user.Groups[session.user.Groups.length-1].Semester.name + " " + session.user.Groups[session.user.Groups.length-1].number
a(id="logout") Logout a(id="logout") Logout
if teacher === true if session.user.permissions === 2
div(id="navprofile" class="teacher" onclick="profilRedirect()") div(id="navprofile" class="teacher" onclick="profilRedirect()")
p Kezel Benoit p=session.user.firstName + " " + session.user.lastName
a(id="logout") Logout a(id="logout") Logout
if admin === true if session.user.permissions === 3
div(id="navprofile" class="admin" onclick="profilRedirect()") div(id="navprofile" class="admin" onclick="profilRedirect()")
p Kezel Benoit p=session.user.firstName + " " + session.user.lastName
a(id="logout") Logout a(id="logout") Logout
div(id="navtop") div(id="navtop")