-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14e2a64
commit d0319cd
Showing
9 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import {OffreDePoste} from "../entity/OffreDePoste"; | |
import {UserRepository} from "../repository/UserRepository"; | ||
import {Alert} from "../utils/Alert"; | ||
import {FicheDePosteRepository} from "../repository/FicheDePosteRepository"; | ||
|
||
const {loggedInNoRedirection} = require("../passport/passportFunctions"); | ||
|
||
|
||
|
@@ -35,7 +36,7 @@ export class HomeController { | |
const alerts: Alert[] = []; | ||
if (req.method === "POST") { | ||
let siren = req.body.siren; | ||
let mail = "[email protected]"; //TO DO get mail from session variable | ||
let mail = req.user.email//TO DO get mail from session variable | ||
if (req.body.siege) { | ||
let organisation: Organisation = new Organisation( | ||
req.body.siren, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {randomBytes} from 'crypto'; | ||
import {loggedInNoRedirection} from "../passport/passportFunctions"; | ||
|
||
export function createCSRFToken(req: any, res: any, next: any) { | ||
if (loggedInNoRedirection(req, res)) { | ||
if (req.session.csrfSecret === undefined) { | ||
req.session.csrfSecret = randomBytes(64).toString("hex"); | ||
console.log("2. in createCSRFToken req.sessionID: ", req.sessionID); | ||
} | ||
} | ||
next(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import {User} from "../entity/User"; | ||
|
||
export {}; | ||
|
||
declare global { | ||
namespace Express { | ||
interface Request { | ||
logout: any; | ||
login: any; | ||
session: any; | ||
user: User; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {Request} from "express"; | ||
|
||
export function csrfValidation(req: Request, csrfToken: string) { | ||
return req.session.csrfSecret === csrfToken; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters