From fb013f8d1e628651581549b60350f9343a20225f Mon Sep 17 00:00:00 2001 From: soudarsane Date: Sun, 18 Jun 2023 23:02:27 +0200 Subject: [PATCH 1/6] =?UTF-8?q?v=C3=A9rifications=20de=20la=20cnil=20au=20?= =?UTF-8?q?niveau=20des=20mots=20de=20passes=20lors=20de=20l'inscription?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/passport/passportFunctions.ts | 13 ++++++----- app/views/register.ejs | 37 +++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/app/passport/passportFunctions.ts b/app/passport/passportFunctions.ts index 2947846..9accb1f 100644 --- a/app/passport/passportFunctions.ts +++ b/app/passport/passportFunctions.ts @@ -23,9 +23,15 @@ passport.use( async (req:any, email:string, password:string, done:any, res:any)=>{ const { nom, prenom, telephone} = req.body; try{ - if(password.length <= 6 || !email){ + const regex = /^(?=.*[a-z].*[a-z])(?=.*[A-Z].*[A-Z])(?=.*\d.*\d)(?=.*[$@!%*?&#].*[$@!%*?&#])[A-Za-z\d$@!%*?&#]{12,}$/; + + if(!email){ + done(null, false, { + message: "Veuillez saisir une adresse email", + }) + }else if(!regex.test(password)){ done(null, false, { - message: "Veuillez saisir un mot de passe de 7 caractères minimum", + message: "Veuillez saisir un mot de passe de 12 caractères minimum comprenant des majuscules, des minuscules, des chiffres et des caractères spéciaux", }) }else{ const hashedPass = await bcrypt.hash(password, 10); @@ -60,9 +66,6 @@ passport.use( } UserRepository.getById(email) .then(async(user) => { - //console.log(user); - //console.log(user.length==0); - //console.log(!user[0]); if (!user[0]) { return done(null, false, { message: "Vérifiez vos identifiants et mot de passe" }); } diff --git a/app/views/register.ejs b/app/views/register.ejs index 70328a3..7187842 100644 --- a/app/views/register.ejs +++ b/app/views/register.ejs @@ -30,12 +30,41 @@
- - + + + +
+
- - + + + From 4a6a710f7610f1128e4417f7abc75cf02250274a Mon Sep 17 00:00:00 2001 From: soudarsane Date: Mon, 19 Jun 2023 15:40:48 +0200 Subject: [PATCH 2/6] tried to use api to get user details --- app/controllers/AdminController.ts | 7 +++- app/controllers/ApiController.ts | 12 +++++- app/entity/User.ts | 8 ++-- app/passport/passportFunctions.ts | 4 +- app/public/js/details.js | 0 app/public/js/filter.js | 2 - app/repository/UserRepository.ts | 38 ++++++++++++++++--- app/routes/ApiRouter.ts | 2 + app/views/admin/demandes.ejs | 61 ++++++++++++++++++++++++++++-- app/views/admin/utilisateurs.ejs | 11 ++++++ 10 files changed, 125 insertions(+), 20 deletions(-) create mode 100644 app/public/js/details.js diff --git a/app/controllers/AdminController.ts b/app/controllers/AdminController.ts index 817f06d..b4be04a 100644 --- a/app/controllers/AdminController.ts +++ b/app/controllers/AdminController.ts @@ -11,12 +11,15 @@ export class AdminController { } static utilisateurs(req: express.Request, res: express.Response) { - res.render("admin/utilisateurs", { title: "Utilisateurs", user: loggedInNoRedirection(req, res)}); + UserRepository.getAll().then((users: User[]) => { + console.log(users); + res.render("admin/utilisateurs", { title: "Utilisateurs", users, user: loggedInNoRedirection(req, res)}); + }); } static demandes(req: express.Request, res: express.Response) { UserRepository.getRecruiterDemand().then((users: User[]) => { - console.log(users); + //console.log(users); res.render("admin/demandes", {title: "Demandes", users: users, user: loggedInNoRedirection(req, res)}); }); } diff --git a/app/controllers/ApiController.ts b/app/controllers/ApiController.ts index 2229a4c..e911b5b 100644 --- a/app/controllers/ApiController.ts +++ b/app/controllers/ApiController.ts @@ -2,6 +2,8 @@ import {OfferRepository} from "../repository/OfferRepository"; import {OffreDePoste} from "../entity/OffreDePoste"; import express from "express"; import {FilterOffer} from "../utils/FilterOffer"; +import {UserRepository} from "../repository/UserRepository"; +import {User} from "../entity/User"; export class ApiController { static getOffers(req: express.Request, res: express.Response) { @@ -16,4 +18,12 @@ export class ApiController { res.json(offers); }); } -} \ No newline at end of file + + static getUser(req: express.Request, res: express.Response) { + console.log("there"); + let email = req.query.email; + UserRepository.getById(String(email)).then((user: User[]) => { + res.json(user); + }); + } +} diff --git a/app/entity/User.ts b/app/entity/User.ts index ff36dba..88588c3 100644 --- a/app/entity/User.ts +++ b/app/entity/User.ts @@ -1,3 +1,5 @@ +import {Organisation} from "./Organisation"; + export class User { email: string; nom: string; @@ -9,10 +11,10 @@ export class User { role: string; demande_organisation: string | null; //TODO replace siren by organisation - siren: string|null; + organisation: Organisation|null; id?: string; - constructor(email: string, nom: string, prenom: string, telephone: string, dateCreation: Date, statut: boolean, passwordHash: string, role: string, demande_organisation: string|null, siren: string|null, id?: string) { + constructor(email: string, nom: string, prenom: string, telephone: string, dateCreation: Date, statut: boolean, passwordHash: string, role: string, demande_organisation: string|null, organisation: Organisation|null, id?: string) { this.email = email; this.nom = nom; this.prenom = prenom; @@ -22,7 +24,7 @@ export class User { this.passwordHash = passwordHash; this.role = role; this.demande_organisation = demande_organisation; - this.siren = siren; + this.organisation = organisation; this.id=id; } diff --git a/app/passport/passportFunctions.ts b/app/passport/passportFunctions.ts index 9accb1f..3472a04 100644 --- a/app/passport/passportFunctions.ts +++ b/app/passport/passportFunctions.ts @@ -6,12 +6,12 @@ const localStrategy = require("passport-local").Strategy; const bcrypt = require("bcrypt"); passport.serializeUser((user:User, done:any) => { - console.log("in serialize user: ", user); + //console.log("in serialize user: ", user); done(null, user); }); passport.deserializeUser((user:User, done:any) => { - console.log("in deserialize user: ", user); + //console.log("in deserialize user: ", user); done(null, user); }); diff --git a/app/public/js/details.js b/app/public/js/details.js new file mode 100644 index 0000000..e69de29 diff --git a/app/public/js/filter.js b/app/public/js/filter.js index 84ad899..f195266 100644 --- a/app/public/js/filter.js +++ b/app/public/js/filter.js @@ -31,8 +31,6 @@ function filterOffer() { offersDiv.append(...generateOffers(offers)); } ); - - } diff --git a/app/repository/UserRepository.ts b/app/repository/UserRepository.ts index 80a6f21..8105ffa 100644 --- a/app/repository/UserRepository.ts +++ b/app/repository/UserRepository.ts @@ -1,6 +1,7 @@ import {User} from "../entity/User"; import {pool} from "../database"; import {OrganisationRepository} from "./OrganisationRepository"; +import {Organisation} from "../entity/Organisation"; const db = pool; @@ -8,8 +9,8 @@ export class UserRepository { static tableName = "Utilisateur"; static getById(email:string): Promise<[User]> { - const query = `SELECT * - FROM ${UserRepository.tableName} u + const query = `SELECT u.email, u.nom, u.prenom, u.telephone, u.date_creation, u.statut, u.password, u.role, u.demande_organisation, o.siren, o.nom as organisation, o.type, o.siege + FROM ${UserRepository.tableName} u INNER JOIN ${OrganisationRepository.tableName} o using (siren) WHERE u.email = ?`; return new Promise<[User]>( (resolve, reject) => @@ -17,17 +18,37 @@ export class UserRepository { if (err) { return reject(err); } + if(result[0]){ + console.log(result[0]); + let organisation = new Organisation(result[0].siren, result[0].organisation, result[0].type, result[0].siege); + result[0].organisation = organisation; + console.log(result); + } + return resolve(result); + } + ) + ); + } + + static getAll(): Promise<[User]> { + const query = `SELECT email, nom, prenom, telephone, date_creation, statut, role, demande_organisation, siren + FROM ${UserRepository.tableName}`; + return new Promise<[User]>( + (resolve, reject) => + pool.query(query, (err, result) => { + if (err) { + return reject(err); + } return resolve(result); } ) ); - //Modifier la table utilisateur : profil recruteur et siren à mettre à jour } static create(entity: User): Promise { const query = `INSERT INTO ${UserRepository.tableName} (email, nom, prenom, telephone, date_creation, statut, password, role, demande_organisation, siren) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`; return new Promise((resolve, reject) => { - pool.query(query, [entity.email, entity.nom, entity.prenom, entity.telephone, entity.dateCreation, entity.statut, entity.passwordHash, entity.role, entity.demande_organisation, entity.siren], (err, result) => { + pool.query(query, [entity.email, entity.nom, entity.prenom, entity.telephone, entity.dateCreation, entity.statut, entity.passwordHash, entity.role, entity.demande_organisation, entity.organisation?.siren], (err, result) => { if (err) { return reject(err); } @@ -46,7 +67,7 @@ export class UserRepository { static getRecruiterDemand(): Promise<[User]> { - const query = `SELECT u.email, u.nom, u.prenom, o.siren, o.nom as organisation + const query = `SELECT u.email, u.nom, u.prenom, o.siren, o.nom as organisation, o.type, o.siege FROM ${UserRepository.tableName} u INNER JOIN ${OrganisationRepository.tableName} o using (siren) WHERE u.demande_organisation = 'En cours'`; @@ -56,11 +77,16 @@ export class UserRepository { if (err) { return reject(err); } + if(result[0]){ + console.log(result[0]); + let organisation = new Organisation(result[0].siren, result[0].organisation, result[0].type, result[0].siege); + result[0].organisation = organisation; + console.log(result); + } return resolve(result); } ) ); - //Modifier la table utilisateur : profil recruteur et siren à mettre à jour } static setDemandAccepted(email: string): Promise<[User]> { diff --git a/app/routes/ApiRouter.ts b/app/routes/ApiRouter.ts index 5fc0854..c072eb8 100644 --- a/app/routes/ApiRouter.ts +++ b/app/routes/ApiRouter.ts @@ -4,3 +4,5 @@ import {ApiController} from "../controllers/ApiController"; export const apiRouter = Router(); apiRouter.get("/offers", ApiController.getOffers); +apiRouter.get("/user", ApiController.getUser); + diff --git a/app/views/admin/demandes.ejs b/app/views/admin/demandes.ejs index c1567fc..1e4b170 100644 --- a/app/views/admin/demandes.ejs +++ b/app/views/admin/demandes.ejs @@ -33,9 +33,9 @@ <%= user.email %> <%= user.nom %> <%= user.prenom %> - <%= user.organisation %> + <%= user.organisation.nom %> - + - - + + + + + diff --git a/app/views/admin/utilisateurs.ejs b/app/views/admin/utilisateurs.ejs index a25cdaf..541b11d 100644 --- a/app/views/admin/utilisateurs.ejs +++ b/app/views/admin/utilisateurs.ejs @@ -48,6 +48,17 @@ + + <% users.forEach((user) => {%> + + <%= user.mail %> + <%= user.nom %> + <%= user.prenom %> + <%= user.siren %> + <%= user.role %> + + + <% }) %> 1 CASSIN From 8b71a17b127aae8f43a0f47c95baca4a6eed7aef Mon Sep 17 00:00:00 2001 From: soudarsane Date: Mon, 19 Jun 2023 21:21:29 +0200 Subject: [PATCH 3/6] admin part see user details and update it --- app/controllers/AdminController.ts | 79 ++++++++++++++-- app/controllers/ApiController.ts | 8 -- app/controllers/CandidatureController.ts | 10 +-- app/controllers/FicheController.ts | 4 +- app/controllers/HomeController.ts | 4 +- app/controllers/OfferController.ts | 2 +- app/controllers/RecruteurController.ts | 9 +- app/passport/passportFunctions.ts | 6 +- app/public/js/details.js | 0 app/repository/UserRepository.ts | 103 ++++++++++++++++----- app/routes/AdminRouter.ts | 5 ++ app/routes/ApiRouter.ts | 1 - app/routes/MainRouter.ts | 6 +- app/views/admin/demande.ejs | 92 +++++++++++++++++++ app/views/admin/demandes.ejs | 57 +----------- app/views/admin/modifierUtilisateur.ejs | 98 ++++++++++++++++++++ app/views/admin/utilisateur.ejs | 92 +++++++++++++++++++ app/views/admin/utilisateurs.ejs | 110 +++-------------------- app/views/partials/adminHeader.ejs | 5 +- app/views/partials/header.ejs | 4 +- app/views/partials/recruteurHeader.ejs | 4 +- 21 files changed, 479 insertions(+), 220 deletions(-) delete mode 100644 app/public/js/details.js create mode 100644 app/views/admin/demande.ejs create mode 100644 app/views/admin/modifierUtilisateur.ejs create mode 100644 app/views/admin/utilisateur.ejs diff --git a/app/controllers/AdminController.ts b/app/controllers/AdminController.ts index b4be04a..965325f 100644 --- a/app/controllers/AdminController.ts +++ b/app/controllers/AdminController.ts @@ -4,37 +4,98 @@ import {OffreDePoste} from "../entity/OffreDePoste"; import {UserRepository} from "../repository/UserRepository"; import {User} from "../entity/User"; import {loggedInNoRedirection} from "../passport/passportFunctions"; +import {OrganisationRepository} from "../repository/OrganisationRepository"; +import {Alert} from "../utils/Alert"; export class AdminController { static index(req: express.Request, res: express.Response) { - res.render("admin/index", { title: "Home", user: loggedInNoRedirection(req, res)}); + res.render("admin/index", { title: "Home", userLogged: loggedInNoRedirection(req, res)}); } static utilisateurs(req: express.Request, res: express.Response) { UserRepository.getAll().then((users: User[]) => { console.log(users); - res.render("admin/utilisateurs", { title: "Utilisateurs", users, user: loggedInNoRedirection(req, res)}); + res.render("admin/utilisateurs", { title: "Utilisateurs", users, userLogged: loggedInNoRedirection(req, res)}); }); } + static utilisateur(req: express.Request, res: express.Response) { + let email = req.params.email; + UserRepository.getById(email).then((user: User) => { + console.log(user); + res.render("admin/utilisateur", {title: "Utilisateur", user: user, userLogged: loggedInNoRedirection(req, res)}); + }) + } + + static async modifierUtilisateur(req: express.Request, res: express.Response) { + if (req.method === "POST") { + const alerts: Alert[] = []; + let user = new User( + req.body.email, + req.body.nom, + req.body.prenom, + req.body.telephone, + req.body.date_creation, + req.body.statut, + "", + req.body.role, + null, + null, + undefined, + ); + + await UserRepository.update(user).then((user: User) => { + let alert = new Alert("success", "L'utilisateur a été modifié"); + alerts.push(alert); + }) + .catch((err) => { + let alert = new Alert("danger", "L'utilisateur n'a pas été modifié"); + alerts.push(alert); + console.log(err); + }); + UserRepository.getById(req.body.email).then((user: User) => { + console.log(user); + res.render("admin/utilisateur", {title: "Utilisateur", user: user, alerts: alerts, userLogged: loggedInNoRedirection(req, res)}); + }) + }else{ + let email = req.params.email; + UserRepository.getById(email).then((user: User) => { + console.log(user); + res.render("admin/modifierUtilisateur", { + title: "Modifier un utilisateur", + user: user, + userLogged: loggedInNoRedirection(req, res) + }); + }) + } + } + static demandes(req: express.Request, res: express.Response) { UserRepository.getRecruiterDemand().then((users: User[]) => { //console.log(users); - res.render("admin/demandes", {title: "Demandes", users: users, user: loggedInNoRedirection(req, res)}); + res.render("admin/demandes", {title: "Demandes", users: users, userLogged: loggedInNoRedirection(req, res)}); }); } - static accepterDemande(req: express.Request, res: express.Response) { + static demande(req: express.Request, res: express.Response) { + let email = req.params.email; + UserRepository.getById(email).then((user: User) => { + console.log(user); + res.render("admin/demande", {title: "Demande", user: user, userLogged: loggedInNoRedirection(req, res)}); + }) + } + + static async accepterDemande(req: express.Request, res: express.Response) { let email = req.params.email; - UserRepository.setDemandAccepted(email).then((email) => { + await UserRepository.setDemandAccepted(email).then((email) => { console.log(email); }); res.redirect("/admin/demandes"); } - static refuserDemande(req: express.Request, res: express.Response) { + static async refuserDemande(req: express.Request, res: express.Response) { let email = req.params.email; - UserRepository.setDemandRefused(email).then((email) => { + await UserRepository.setDemandRefused(email).then((email) => { console.log(email); }); res.redirect("/admin/demandes"); @@ -43,7 +104,7 @@ export class AdminController { static offres(req: express.Request, res: express.Response) { OfferRepository.getAll().then((offers: OffreDePoste[]) => { console.log(offers); - res.render("admin/offres", {title: "Offres", offers: offers, user: loggedInNoRedirection(req, res)}); + res.render("admin/offres", {title: "Offres", offers: offers, userLogged: loggedInNoRedirection(req, res)}); }); } @@ -51,7 +112,7 @@ export class AdminController { let numero = req.params.numero; OfferRepository.getById(Number.parseInt(numero)).then((offer: OffreDePoste) => { console.log(offer); - res.render("admin/offre", {title: "Offre", offer: offer, user: loggedInNoRedirection(req, res)}); + res.render("admin/offre", {title: "Offre", offer: offer, userLogged: loggedInNoRedirection(req, res)}); }) } } diff --git a/app/controllers/ApiController.ts b/app/controllers/ApiController.ts index e911b5b..96ff66b 100644 --- a/app/controllers/ApiController.ts +++ b/app/controllers/ApiController.ts @@ -18,12 +18,4 @@ export class ApiController { res.json(offers); }); } - - static getUser(req: express.Request, res: express.Response) { - console.log("there"); - let email = req.query.email; - UserRepository.getById(String(email)).then((user: User[]) => { - res.json(user); - }); - } } diff --git a/app/controllers/CandidatureController.ts b/app/controllers/CandidatureController.ts index d8eee76..3606d0d 100644 --- a/app/controllers/CandidatureController.ts +++ b/app/controllers/CandidatureController.ts @@ -14,7 +14,7 @@ export class CandidatureController { static candidater(req: express.Request, res: express.Response) { //TODO Vérifier que l'utilisateur est bien un candidat - let user: User = new User('tsoudar21@gmail.com', 'Tillai', 'Soudarsane', '0652645299', new Date('2020-10-10'), false, 'mdp', 'Candidat', "", "123456"); + let user: User = new User('tsoudar21@gmail.com', 'Tillai', 'Soudarsane', '0652645299', new Date('2020-10-10'), false, 'mdp', 'Candidat', "", null); let alerts: Alert[] = []; let numero: number = Number.parseInt(req.params.numero); @@ -26,7 +26,7 @@ export class CandidatureController { let alert = new Alert("danger", "La motivation doit faire plus de 20 caractères."); alerts.push(alert); } else { - let user: User = new User('candidat1@example.com', 'Doe', 'John', '123456789', new Date(), true, 'password123', 'Candidat', 'En attente', '1566'); + let user: User = new User('candidat1@example.com', 'Doe', 'John', '123456789', new Date(), true, 'password123', 'Candidat', 'En attente', null); let candidature: Candidature = new Candidature(new Date(), user, offer, StatutCandidatureEnum.EN_ATTENTE, req.body.motivation); await CandidatureRepository.create(candidature).then(async (candidature) => { //upload file: @@ -64,7 +64,7 @@ export class CandidatureController { } } - res.render("candidater", {title: "Candidater", offer: offer, alerts: alerts, user: loggedInNoRedirection(req, res)}); + res.render("candidater", {title: "Candidater", offer: offer, alerts: alerts, userLogged: loggedInNoRedirection(req, res)}); } ) @@ -76,9 +76,9 @@ export class CandidatureController { static candidatures(req: express.Request, res: express.Response) { //TODO Vérifier que l'utilisateur est bien un candidat - let user: User = new User('candidat1@example.com', 'Doe', 'John', '123456789', new Date(), true, 'password123', 'Candidat', 'En attente', '1566'); + let user: User = new User('candidat1@example.com', 'Doe', 'John', '123456789', new Date(), true, 'password123', 'Candidat', 'En attente', null); CandidatureRepository.getByUser(user).then((candidatures) => { - res.render("candidatures", {title: "Mes candidatures", candidatures: candidatures, user: loggedInNoRedirection(req, res)}); + res.render("candidatures", {title: "Mes candidatures", candidatures: candidatures, userLogged: loggedInNoRedirection(req, res)}); }).catch((err) => { console.log(err); diff --git a/app/controllers/FicheController.ts b/app/controllers/FicheController.ts index fd2fd1b..abb7cd3 100644 --- a/app/controllers/FicheController.ts +++ b/app/controllers/FicheController.ts @@ -14,7 +14,7 @@ export class FicheController { //TODO get the siren from the recruiter //random number 9 digits - let siren: string = req.user.siren as string; + let siren: string = req.user.organisation?.siren as string; let nbHeures: number = parseInt(req.body.nbHeures); @@ -42,7 +42,7 @@ export class FicheController { } //TODO get the siren from the recruiter - res.render("fiche/creation", {title: "Créer une fiche de poste", alerts: alerts, user: loggedInNoRedirection(req, res)}); + res.render("fiche/creation", {title: "Créer une fiche de poste", alerts: alerts, userLogged: loggedInNoRedirection(req, res)}); } } diff --git a/app/controllers/HomeController.ts b/app/controllers/HomeController.ts index 7691db2..2ad3ce7 100644 --- a/app/controllers/HomeController.ts +++ b/app/controllers/HomeController.ts @@ -17,7 +17,7 @@ export class HomeController { //For testing mock getAll() method FicheDePosteRepository.getDistinctRegion().then((regions: string[]) => { OfferRepository.getAll().then((offers: OffreDePoste[]) => { - res.render("index", {title: "Home", offers: offers, regions: regions, user: loggedInNoRedirection(req, res)}); + res.render("index", {title: "Home", offers: offers, regions: regions, userLogged: loggedInNoRedirection(req, res)}); }); }); @@ -75,7 +75,7 @@ export class HomeController { } OrganisationRepository.getAll().then((organisations: Organisation[]) => { - res.render("demandeRecruteur", {title: "Recruteur", organisations: organisations, alerts: alerts, user: loggedInNoRedirection(req, res)}); + res.render("demandeRecruteur", {title: "Recruteur", organisations: organisations, alerts: alerts, userLogged: loggedInNoRedirection(req, res)}); }); } } diff --git a/app/controllers/OfferController.ts b/app/controllers/OfferController.ts index 5fbd30d..c7370ed 100644 --- a/app/controllers/OfferController.ts +++ b/app/controllers/OfferController.ts @@ -78,7 +78,7 @@ export class OfferController { title: "Créer une offre", ficheDePostes: ficheDePostes, alerts: alerts, - user: loggedInNoRedirection(req, res), + userLogged: loggedInNoRedirection(req, res), csrfToken: req.session.csrfSecret }); }); diff --git a/app/controllers/RecruteurController.ts b/app/controllers/RecruteurController.ts index 35b08f6..33b140d 100644 --- a/app/controllers/RecruteurController.ts +++ b/app/controllers/RecruteurController.ts @@ -2,12 +2,13 @@ import express from "express"; import {CandidatureRepository} from "../repository/CandidatureRepository"; import {Alert} from "../utils/Alert"; import {OfferRepository} from "../repository/OfferRepository"; +import {loggedInNoRedirection} from "../passport/passportFunctions"; export class RecruteurController { static index(req: express.Request, res: express.Response) { //Get candidatures by siren - res.render("recruteur/index", {title: "Home"}); + res.render("recruteur/index", {title: "Home", userLogged: loggedInNoRedirection(req, res)}); } static candidatures(req: express.Request, res: express.Response) { @@ -16,7 +17,7 @@ export class RecruteurController { let alerts: Alert[] = []; CandidatureRepository.getBySiren(siren).then((candidatures) => { - res.render("recruteur/candidatures", {title: "Candidatures", candidatures: candidatures}); + res.render("recruteur/candidatures", {title: "Candidatures", candidatures: candidatures, userLogged: loggedInNoRedirection(req, res)}); }).catch((err) => { alerts.push(new Alert("danger", "Erreur lors de la récupération des candidatures")); res.redirect("/recruteur"); @@ -27,7 +28,7 @@ export class RecruteurController { let siren = '123456'; let alerts: Alert[] = []; OfferRepository.getBySiren(siren).then((offers) => { - res.render("recruteur/offres", {title: "Offres", offers: offers}); + res.render("recruteur/offres", {title: "Offres", offers: offers, userLogged: loggedInNoRedirection(req, res)}); }); } -} \ No newline at end of file +} diff --git a/app/passport/passportFunctions.ts b/app/passport/passportFunctions.ts index 3472a04..0bb7423 100644 --- a/app/passport/passportFunctions.ts +++ b/app/passport/passportFunctions.ts @@ -66,15 +66,15 @@ passport.use( } UserRepository.getById(email) .then(async(user) => { - if (!user[0]) { + if (!user) { return done(null, false, { message: "Vérifiez vos identifiants et mot de passe" }); } - /*let userLogged: User = new User(user[0].email, user[0].nom, user[0].prenom, user[0].telephone, user[0].date_creation, user[0].statut, user[0].password, user[0].role, user[0].demande_organisation, user[0].siren); + let userLogged: User = new User(user.email, user.nom, user.prenom, user.telephone, user.dateCreation, user.statut, user.passwordHash, user.role, user.demande_organisation, user.organisation); const passwordMatches = await bcrypt.compare(password, userLogged.passwordHash); if (!passwordMatches) { return done(null, false, { message: "Mot de passe incorrect" }); - }*/ + } return done(null, user, { message: "Vous êtes connecté!" }); }) diff --git a/app/public/js/details.js b/app/public/js/details.js deleted file mode 100644 index e69de29..0000000 diff --git a/app/repository/UserRepository.ts b/app/repository/UserRepository.ts index 8105ffa..4dc84b8 100644 --- a/app/repository/UserRepository.ts +++ b/app/repository/UserRepository.ts @@ -8,38 +8,83 @@ const db = pool; export class UserRepository { static tableName = "Utilisateur"; - static getById(email:string): Promise<[User]> { - const query = `SELECT u.email, u.nom, u.prenom, u.telephone, u.date_creation, u.statut, u.password, u.role, u.demande_organisation, o.siren, o.nom as organisation, o.type, o.siege - FROM ${UserRepository.tableName} u INNER JOIN ${OrganisationRepository.tableName} o using (siren) + static getById(email:string): Promise { + const query = `SELECT u.email, u.nom, u.prenom, u.telephone, DATE_FORMAT(u.date_creation, '%d-%m-%Y') as date_creation, u.statut, u.password, u.role, u.demande_organisation, o.siren, o.nom as organisation, o.type, o.siege + FROM ${UserRepository.tableName} u LEFT JOIN ${OrganisationRepository.tableName} o using (siren) WHERE u.email = ?`; - return new Promise<[User]>( + return new Promise( (resolve, reject) => pool.query(query,[email], (err, result) => { - if (err) { - return reject(err); - } - if(result[0]){ - console.log(result[0]); - let organisation = new Organisation(result[0].siren, result[0].organisation, result[0].type, result[0].siege); - result[0].organisation = organisation; - console.log(result); + if (err) { + return reject(err); } - return resolve(result); + console.log(result); + let organisation = new Organisation( + result[0].siren, + result[0].organisation, + result[0].type, + result[0].siege + ); + let user = new User( + result[0].email, + result[0].nom, + result[0].prenom, + result[0].telephone, + result[0].date_creation, + result[0].statut, + result[0].password, + result[0].role, + result[0].demande_organisation, + organisation, + undefined + ); + + console.log(user); + return resolve(user); } ) ); } static getAll(): Promise<[User]> { - const query = `SELECT email, nom, prenom, telephone, date_creation, statut, role, demande_organisation, siren - FROM ${UserRepository.tableName}`; + const query = `SELECT u.email, u.nom, u.prenom, u.telephone, DATE_FORMAT(u.date_creation, '%d-%m-%Y') as date_creation, u.statut, u.password, u.role, u.demande_organisation, o.siren, o.nom as organisation, o.type, o.siege + FROM ${UserRepository.tableName} u LEFT JOIN ${OrganisationRepository.tableName} o using (siren)`; + return new Promise<[User]>( (resolve, reject) => pool.query(query, (err, result) => { - if (err) { - return reject(err); - } - return resolve(result); + if (err) { + return reject(err); + } + + let organisation; + let user; + console.log(result) + for (let i = 0; i < result.length; i++) { + organisation = new Organisation( + result[i].siren, + result[i].organisation, + result[i].type, + result[i].siege + ); + user = new User( + result[i].email, + result[i].nom, + result[i].prenom, + result[i].telephone, + result[i].date_creation, + result[i].statut, + result[i].password, + result[i].role, + result[i].demande_organisation, + organisation, + undefined + ); + result[i] = user; + } + console.log(result) + + return resolve(result); } ) ); @@ -57,8 +102,24 @@ export class UserRepository { }); } - update(id: number, entity: User): Promise { - throw new Error("Method not implemented."); + static update(user : User): Promise { + const query = `UPDATE ${UserRepository.tableName} + SET nom = ?, + prenom = ?, + telephone = ?, + statut = ?, + role = ? + WHERE email = ?`; + return new Promise( + (resolve, reject) => + pool.query(query, [user.nom, user.prenom, user.telephone, user.statut, user.role, user.email], (err, result) => { + if (err) { + return reject(err); + } + return resolve(result); + } + ) + ); } delete(id: number): Promise { diff --git a/app/routes/AdminRouter.ts b/app/routes/AdminRouter.ts index 873233a..10d62b4 100644 --- a/app/routes/AdminRouter.ts +++ b/app/routes/AdminRouter.ts @@ -14,7 +14,12 @@ adminRouter.use(checkRole("Administrateur")); adminRouter.get("/", AdminController.index); adminRouter.get("/utilisateurs", AdminController.utilisateurs); +adminRouter.get("/utilisateur/:email", AdminController.utilisateur); +adminRouter.get("/modifierUtilisateur/:email", AdminController.modifierUtilisateur); +adminRouter.post("/modifierUtilisateur/:email", AdminController.modifierUtilisateur); + adminRouter.get("/demandes", AdminController.demandes); +adminRouter.get("/demande/:email", AdminController.demande); adminRouter.get("/accepterDemande/:email", AdminController.accepterDemande); adminRouter.get("/refuserDemande/:email", AdminController.refuserDemande); adminRouter.get("/offres", AdminController.offres); diff --git a/app/routes/ApiRouter.ts b/app/routes/ApiRouter.ts index c072eb8..793eaa9 100644 --- a/app/routes/ApiRouter.ts +++ b/app/routes/ApiRouter.ts @@ -4,5 +4,4 @@ import {ApiController} from "../controllers/ApiController"; export const apiRouter = Router(); apiRouter.get("/offers", ApiController.getOffers); -apiRouter.get("/user", ApiController.getUser); diff --git a/app/routes/MainRouter.ts b/app/routes/MainRouter.ts index e9f5c88..677a77c 100644 --- a/app/routes/MainRouter.ts +++ b/app/routes/MainRouter.ts @@ -20,7 +20,7 @@ defaultRouter.use( resave: false, saveUninitialized: false, cookie: { - maxAge: 1200000 + maxAge: 3600000 } }) ); @@ -45,8 +45,8 @@ defaultRouter.post( if (!user) { return res.redirect(`/login?message=${info.message}`); } - req.login(user[0], async () => { - let role = user[0].role; + req.login(user, async () => { + let role = user.role; let url; if (role == "Administrateur") { url="admin"; diff --git a/app/views/admin/demande.ejs b/app/views/admin/demande.ejs new file mode 100644 index 0000000..699fd79 --- /dev/null +++ b/app/views/admin/demande.ejs @@ -0,0 +1,92 @@ +<%- include('../partials/adminHeader.ejs') %>. + + + + diff --git a/app/views/admin/demandes.ejs b/app/views/admin/demandes.ejs index 1e4b170..c144b18 100644 --- a/app/views/admin/demandes.ejs +++ b/app/views/admin/demandes.ejs @@ -35,7 +35,7 @@ <%= user.prenom %> <%= user.organisation.nom %> - + Détails - - - - - diff --git a/app/views/admin/modifierUtilisateur.ejs b/app/views/admin/modifierUtilisateur.ejs new file mode 100644 index 0000000..c60175e --- /dev/null +++ b/app/views/admin/modifierUtilisateur.ejs @@ -0,0 +1,98 @@ +<%- include('../partials/adminHeader.ejs') %>. + + + + diff --git a/app/views/admin/utilisateur.ejs b/app/views/admin/utilisateur.ejs new file mode 100644 index 0000000..ec5ceae --- /dev/null +++ b/app/views/admin/utilisateur.ejs @@ -0,0 +1,92 @@ +<%- include('../partials/adminHeader.ejs') %>. + +
+
+
+ Image création d'entreprise +
+

Informations Utilisateur

+
+
+
+ +

<%= user.nom %>

+
+ +
+ +

<%= user.prenom %>

+
+ +
+ +

<%= user.email %>

+
+ +
+ +

<%= user.telephone %>

+
+ +
+ +

<%= user.dateCreation %>

+
+ +
+ +

<%= user.statut === 1 ? 'Actif' : 'Inactif' %>

+
+ +
+ +

<%= user.role %>

+
+ +
+ +

<%= user.demande_organisation ? user.demande_organisation : 'Aucune' %>

+
+
+ + <% if (user.organisation.siren) { %> +
+

Organisation

+
+
+ +

<%= user.organisation.nom %>

+
+ +
+ +

<%= user.organisation.siege %>

+
+ +
+ +

<%= user.organisation.type %>

+
+ +
+ +

<%= user.organisation.siren %>

+
+
+ + <% } %> + +
+ + +
+
+
+
+
+ + diff --git a/app/views/admin/utilisateurs.ejs b/app/views/admin/utilisateurs.ejs index 541b11d..69a88d2 100644 --- a/app/views/admin/utilisateurs.ejs +++ b/app/views/admin/utilisateurs.ejs @@ -54,107 +54,19 @@ <%= user.mail %> <%= user.nom %> <%= user.prenom %> - <%= user.siren %> - <%= user.role %> - + <%= user.organisation.nom ? user.organisation.nom : 'Aucune' %> + + <% if (user.role === 'Candidat') { %> + <%= user.role %> + <% } else if (user.role === 'Recruteur') { %> + <%= user.role %> + <% } else if (user.role === 'Administrateur') { %> + <%= user.role %> + <% } %> + + Détails <% }) %> - - 1 - CASSIN - René - Banque Postale - Recruteur - - - - 2 - JACQUES - Jacob - Carrefour - Candidat - - - - 3 - PATRICK - la banane - Mercedes - Candidat - - - - 4 - Henri - le roy - Tesla - Candidat - - - - 5 - CASSIN - René - Banque Postale - Candidat - - - - 6 - JACQUES - Jacob - Carrefour - Candidat - - - - 7 - PATRICK - la banane - Mercedes - Candidat - - - - 8 - Henri - le roy - Tesla - Candidat - - - - 9 - CASSIN - René - Banque Postale - Candidat - - - - 10 - JACQUES - Jacob - Carrefour - Recruteur - - - - 11 - PATRICK - la banane - Mercedes - Candidat - - - - 12 - Henri - le roy - Tesla - Candidat - - diff --git a/app/views/partials/adminHeader.ejs b/app/views/partials/adminHeader.ejs index 0dca1f2..71b4784 100644 --- a/app/views/partials/adminHeader.ejs +++ b/app/views/partials/adminHeader.ejs @@ -36,10 +36,11 @@ +<%- include('alert.ejs') %> diff --git a/app/views/partials/header.ejs b/app/views/partials/header.ejs index f20f7fb..20efe05 100644 --- a/app/views/partials/header.ejs +++ b/app/views/partials/header.ejs @@ -31,8 +31,8 @@ diff --git a/app/views/partials/recruteurHeader.ejs b/app/views/partials/recruteurHeader.ejs index 18e1390..d017b28 100644 --- a/app/views/partials/recruteurHeader.ejs +++ b/app/views/partials/recruteurHeader.ejs @@ -35,8 +35,8 @@ From 1cf096c6ade4c8290a43a9af720495f2fc95c983 Mon Sep 17 00:00:00 2001 From: soudarsane Date: Mon, 19 Jun 2023 22:38:53 +0200 Subject: [PATCH 4/6] =?UTF-8?q?filtre=20pour=20les=20utilisateurs=20et=20l?= =?UTF-8?q?es=20demandes=20=C3=A0=20rejoindre=20=C3=A0=20peaufiner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/demande.ejs | 23 ++++++----- app/views/admin/demandes.ejs | 39 ++++++++++++++++-- app/views/admin/utilisateurs.ejs | 71 +++++++++++++++++++++----------- 3 files changed, 96 insertions(+), 37 deletions(-) diff --git a/app/views/admin/demande.ejs b/app/views/admin/demande.ejs index 699fd79..ba2da6d 100644 --- a/app/views/admin/demande.ejs +++ b/app/views/admin/demande.ejs @@ -5,22 +5,22 @@
Image création d'entreprise
-

Utilisateur

+

Demande

- -

<%= user.nom %> <%= user.prenom %>

+ +

<%= user.nom %>

-
- -

<%= user.organisation.nom %>

+
+ +

<%= user.prenom %>

-
- -

<%= user.organisation.ville %>

+
+ +

<%= user.email %>

@@ -81,7 +81,10 @@
diff --git a/app/views/admin/demandes.ejs b/app/views/admin/demandes.ejs index c144b18..b685d1b 100644 --- a/app/views/admin/demandes.ejs +++ b/app/views/admin/demandes.ejs @@ -16,7 +16,17 @@
- +

Filtres

+
+
Entreprise
+ + +
@@ -27,13 +37,13 @@ - + <% users.forEach((user) => { %> - + - + @@ -52,4 +62,25 @@ + + + diff --git a/app/views/admin/utilisateurs.ejs b/app/views/admin/utilisateurs.ejs index 69a88d2..72dc433 100644 --- a/app/views/admin/utilisateurs.ejs +++ b/app/views/admin/utilisateurs.ejs @@ -2,7 +2,7 @@ - Utilisateur + Utilisateurs + From 1b03e95b6089b55486bd9aab56a5a77bede13d70 Mon Sep 17 00:00:00 2001 From: soudarsane Date: Tue, 20 Jun 2023 10:29:44 +0200 Subject: [PATCH 5/6] =?UTF-8?q?partie=20admin=20onglets=20utilisateurs=20e?= =?UTF-8?q?t=20demandes=20termin=C3=A9s=20(reste=20l'onglet=20accueil=20et?= =?UTF-8?q?=20offres=20+=20rediriger=20vers=20page=20candidat=20et=20affic?= =?UTF-8?q?her=20bouton=20administrer)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/AdminController.ts | 35 ++++- app/repository/UserRepository.ts | 47 +++++- app/routes/AdminRouter.ts | 1 + app/table.sql | 2 +- app/views/admin/demandes.ejs | 182 +++++++++++++++--------- app/views/admin/modifierUtilisateur.ejs | 4 +- app/views/admin/utilisateur.ejs | 19 ++- app/views/admin/utilisateurs.ejs | 8 +- 8 files changed, 210 insertions(+), 88 deletions(-) diff --git a/app/controllers/AdminController.ts b/app/controllers/AdminController.ts index 965325f..c8fc7dd 100644 --- a/app/controllers/AdminController.ts +++ b/app/controllers/AdminController.ts @@ -4,8 +4,9 @@ import {OffreDePoste} from "../entity/OffreDePoste"; import {UserRepository} from "../repository/UserRepository"; import {User} from "../entity/User"; import {loggedInNoRedirection} from "../passport/passportFunctions"; -import {OrganisationRepository} from "../repository/OrganisationRepository"; import {Alert} from "../utils/Alert"; +import {OrganisationRepository} from "../repository/OrganisationRepository"; +import {Organisation} from "../entity/Organisation"; export class AdminController { static index(req: express.Request, res: express.Response) { @@ -14,8 +15,10 @@ export class AdminController { static utilisateurs(req: express.Request, res: express.Response) { UserRepository.getAll().then((users: User[]) => { - console.log(users); - res.render("admin/utilisateurs", { title: "Utilisateurs", users, userLogged: loggedInNoRedirection(req, res)}); + OrganisationRepository.getAll().then((organisations : Organisation[]) => { + console.log(users); + res.render("admin/utilisateurs", { title: "Utilisateurs", organisations: organisations, users, userLogged: loggedInNoRedirection(req, res)}); + }); }); } @@ -70,10 +73,32 @@ export class AdminController { } } + static async supprimerUtilisateur(req: express.Request, res: express.Response) { + let email = req.params.email; + const alerts: Alert[] = []; + + await UserRepository.supprimerUtilisateur(email).then((user: User) => { + let alert = new Alert("success", "L'utilisateur a bien été supprimé"); + alerts.push(alert); + }) + .catch((err) => { + let alert = new Alert("danger", "L'utilisateur n'a pas été supprimé"); + alerts.push(alert); + console.log(err); + }); + + UserRepository.getAll().then((users: User[]) => { + res.render("admin/utilisateurs", { title: "Utilisateurs", users, alerts: alerts, userLogged: loggedInNoRedirection(req, res)}); + }); + } + static demandes(req: express.Request, res: express.Response) { UserRepository.getRecruiterDemand().then((users: User[]) => { - //console.log(users); - res.render("admin/demandes", {title: "Demandes", users: users, userLogged: loggedInNoRedirection(req, res)}); + UserRepository.getOldRecruiterDemand().then((oldUsers: User[]) => { + OrganisationRepository.getAll().then((organisations : Organisation[]) => { + res.render("admin/demandes", {title: "Demandes", users: users, organisations: organisations, oldUsers: oldUsers, userLogged: loggedInNoRedirection(req, res)}); + }); + }); }); } diff --git a/app/repository/UserRepository.ts b/app/repository/UserRepository.ts index 4dc84b8..1cd1629 100644 --- a/app/repository/UserRepository.ts +++ b/app/repository/UserRepository.ts @@ -122,16 +122,52 @@ export class UserRepository { ); } - delete(id: number): Promise { - throw new Error("Method not implemented."); + static supprimerUtilisateur(email:string): Promise { + const query = `DELETE FROM ${UserRepository.tableName} + WHERE email = ?`; + return new Promise( + (resolve, reject) => + pool.query(query, [email], (err, result) => { + if (err) { + return reject(err); + } + return resolve(result); + } + ) + ); } - static getRecruiterDemand(): Promise<[User]> { const query = `SELECT u.email, u.nom, u.prenom, o.siren, o.nom as organisation, o.type, o.siege FROM ${UserRepository.tableName} u INNER JOIN ${OrganisationRepository.tableName} o using (siren) - WHERE u.demande_organisation = 'En cours'`; + WHERE u.demande_organisation = 'En cours' + OR u.demande_organisation = 'refus' + OR u.demande_organisation = 'acceptation'`; + return new Promise<[User]>( + (resolve, reject) => + pool.query(query, (err, result) => { + if (err) { + return reject(err); + } + if(result[0]){ + console.log(result[0]); + let organisation = new Organisation(result[0].siren, result[0].organisation, result[0].type, result[0].siege); + result[0].organisation = organisation; + console.log(result); + } + return resolve(result); + } + ) + ); + } + + static getOldRecruiterDemand(): Promise<[User]> { + const query = `SELECT u.email, u.nom, u.prenom, u.demande_organisation, o.siren, o.nom as organisation, o.type, o.siege + FROM ${UserRepository.tableName} u + INNER JOIN ${OrganisationRepository.tableName} o using (siren) + WHERE u.demande_organisation = 'refus' + OR u.demande_organisation = 'acceptation'`; return new Promise<[User]>( (resolve, reject) => pool.query(query, (err, result) => { @@ -170,8 +206,7 @@ export class UserRepository { static setDemandRefused(email: string): Promise<[User]> { const query = `UPDATE ${UserRepository.tableName} SET demande_organisation = 'refus', - role='Candidat', - siren=null + role='Candidat' WHERE email = ?`; return new Promise<[User]>( (resolve, reject) => diff --git a/app/routes/AdminRouter.ts b/app/routes/AdminRouter.ts index 10d62b4..9789869 100644 --- a/app/routes/AdminRouter.ts +++ b/app/routes/AdminRouter.ts @@ -17,6 +17,7 @@ adminRouter.get("/utilisateurs", AdminController.utilisateurs); adminRouter.get("/utilisateur/:email", AdminController.utilisateur); adminRouter.get("/modifierUtilisateur/:email", AdminController.modifierUtilisateur); adminRouter.post("/modifierUtilisateur/:email", AdminController.modifierUtilisateur); +adminRouter.get("/supprimerUtilisateur/:email", AdminController.supprimerUtilisateur); adminRouter.get("/demandes", AdminController.demandes); adminRouter.get("/demande/:email", AdminController.demande); diff --git a/app/table.sql b/app/table.sql index 693507a..bfdd177 100644 --- a/app/table.sql +++ b/app/table.sql @@ -97,7 +97,7 @@ CREATE TABLE `Utilisateur` ((demande_organisation = 'En cours' OR demande_organisation = 'acceptation' OR role = 'Recruteur') AND siren IS NOT NULL) OR - ((demande_organisation = 'refus' OR role = 'Administrateur' OR role = 'Candidat') AND siren IS NULL) + ((demande_organisation = 'refus' OR role = 'Administrateur' OR role = 'Candidat')) ) ); diff --git a/app/views/admin/demandes.ejs b/app/views/admin/demandes.ejs index b685d1b..6398d08 100644 --- a/app/views/admin/demandes.ejs +++ b/app/views/admin/demandes.ejs @@ -1,16 +1,3 @@ - - - - - Demandes - - - - - <%- include('../partials/adminHeader.ejs') %>.
@@ -21,66 +8,123 @@
Entreprise
-
idStatut
<%= user.email %> <%= user.nom %> <%= user.prenom %><%= user.organisation.nom %><%= user.organisation.nom %> Détails
- - - - - - - - - - - - <% users.forEach((user) => { %> - - - - - - - - - <% }) %> - -
idNomPrénomEntrepriseDétailsStatut
<%= user.email %><%= user.nom %><%= user.prenom %><%= user.organisation.nom %> - Détails - - Refuser - Accepter -
-
-
-
- - + row.style.display = shouldShowRow ? "table-row" : "none"; + }); + } - - + const entrepriseFilter = document.querySelector("#entrepriseFilter"); + entrepriseFilter.addEventListener("change", filterDemandes); + +
+
+
diff --git a/app/views/admin/modifierUtilisateur.ejs b/app/views/admin/modifierUtilisateur.ejs index c60175e..0ffd356 100644 --- a/app/views/admin/modifierUtilisateur.ejs +++ b/app/views/admin/modifierUtilisateur.ejs @@ -53,7 +53,7 @@
- +
@@ -86,7 +86,7 @@
- Retour + Retour
diff --git a/app/views/admin/utilisateur.ejs b/app/views/admin/utilisateur.ejs index ec5ceae..b9691e8 100644 --- a/app/views/admin/utilisateur.ejs +++ b/app/views/admin/utilisateur.ejs @@ -81,12 +81,29 @@
Retour Modifier - Supprimer +
+ diff --git a/app/views/admin/utilisateurs.ejs b/app/views/admin/utilisateurs.ejs index 72dc433..cf60056 100644 --- a/app/views/admin/utilisateurs.ejs +++ b/app/views/admin/utilisateurs.ejs @@ -20,10 +20,10 @@
Entreprise
Profil
From e8ee9af91f3d25ce9790bf0ad999c87c779d28a3 Mon Sep 17 00:00:00 2001 From: soudarsane Date: Tue, 20 Jun 2023 11:37:08 +0200 Subject: [PATCH 6/6] debug ligne en double --- app/controllers/RecruteurController.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/RecruteurController.ts b/app/controllers/RecruteurController.ts index 29fef0b..5bd1e14 100644 --- a/app/controllers/RecruteurController.ts +++ b/app/controllers/RecruteurController.ts @@ -3,7 +3,6 @@ import {CandidatureRepository} from "../repository/CandidatureRepository"; import {Alert} from "../utils/Alert"; import {loggedInNoRedirection} from "../passport/passportFunctions"; import {OfferRepository} from "../repository/OfferRepository"; -import {loggedInNoRedirection} from "../passport/passportFunctions"; export class RecruteurController { static index(req: express.Request, res: express.Response) {