Fix name and group display on views
This commit is contained in:
parent
4bc5d00344
commit
f08e249701
2 changed files with 11 additions and 8 deletions
|
@ -2,7 +2,7 @@ const models = require("../models");
|
|||
|
||||
module.exports = socket => {
|
||||
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)
|
||||
socket.emit("login", {error: {message: "not_found"}});
|
||||
else if (!user.checkPassword(data.password))
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
extends layout
|
||||
|
||||
block navbar
|
||||
if student === true
|
||||
if session.user.permissions === 1
|
||||
div(id="navprofile" class="student" onclick="profilRedirect()")
|
||||
p Kezel Benoit
|
||||
p G4S3
|
||||
p=session.user.firstName + " " + session.user.lastName
|
||||
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
|
||||
if teacher === true
|
||||
if session.user.permissions === 2
|
||||
div(id="navprofile" class="teacher" onclick="profilRedirect()")
|
||||
p Kezel Benoit
|
||||
p=session.user.firstName + " " + session.user.lastName
|
||||
a(id="logout") Logout
|
||||
if admin === true
|
||||
if session.user.permissions === 3
|
||||
div(id="navprofile" class="admin" onclick="profilRedirect()")
|
||||
p Kezel Benoit
|
||||
p=session.user.firstName + " " + session.user.lastName
|
||||
a(id="logout") Logout
|
||||
|
||||
div(id="navtop")
|
||||
|
|
Reference in a new issue