-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(user): add certification routes
- Loading branch information
1 parent
020e84f
commit 41ff30d
Showing
5 changed files
with
186 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// | ||
|
||
import type { NextFunction, Request, Response } from "express"; | ||
import { csrfToken } from "../../middlewares/csrf-protection"; | ||
|
||
// | ||
|
||
export async function getCertificationDirigeantController( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) { | ||
try { | ||
return res.render("user/certification-dirigeant", { | ||
csrfToken: csrfToken(req), | ||
pageTitle: "Certification dirigeant", | ||
}); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
export async function postCertificationDirigeantController( | ||
_req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) { | ||
try { | ||
return res.redirect("/users/certification-dirigeant/login-as"); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
// | ||
|
||
export async function getCertificationDirigeantLoginAsController( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) { | ||
try { | ||
return res.render("user/certification-dirigeant-login-as", { | ||
csrfToken: csrfToken(req), | ||
pageTitle: "Se connecter en tant que", | ||
}); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
export async function postCertificationDirigeantLoginAsController( | ||
_req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) { | ||
try { | ||
return res.redirect("/users/certification-dirigeant/representing"); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} | ||
|
||
// | ||
|
||
export async function getCertificationDirigeantRepresentingController( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) { | ||
try { | ||
const userOrganizations = [ | ||
{ | ||
id: "1", | ||
siret: "12345678901234", | ||
cached_libelle: "Organisation 1", | ||
cached_adresse: "123 rue de la paix", | ||
cached_libelle_activite_principale: "Activité principale 1", | ||
}, | ||
]; | ||
return res.render("user/select-organization", { | ||
csrfToken: csrfToken(req), | ||
illustration: "illu-password.svg", | ||
pageTitle: "Choisir une organisation", | ||
userOrganizations, | ||
}); | ||
} catch (error) { | ||
next(error); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div> | ||
<h2 class="fr-h2">Vous allez vous connecter en tant que :</h2> | ||
<center> | ||
<h1 class="fr-h3 blue-france">Jacintha Froment</h1> | ||
</center> | ||
|
||
<form action="/users/certification-dirigeant/login-as" method="post"> | ||
<input type="hidden" name="_csrf" value="<%= csrfToken; %>" /> | ||
|
||
<fieldset class="fr-fieldset" aria-labelledby="agreement"> | ||
<div class="fr-fieldset__element"> | ||
<div class="fr-checkbox-group"> | ||
<input name="agreement" id="agreement" type="checkbox" /> | ||
<label class="fr-label" for="agreement"> | ||
J'accepte que FranceConnect transmette mes données au service pour | ||
me connecter | ||
</label> | ||
</div> | ||
</div> | ||
</fieldset> | ||
|
||
<button class="fr-btn" type="submit">Continuer</button> | ||
</form> | ||
</div> |
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,28 @@ | ||
<div> | ||
<h1 class="fr-h3">Authentifier votre statut</h1> | ||
|
||
<p> | ||
Vous pouvez authentifier instantanément votre statut de dirigeant grâce à | ||
FranceConnect. | ||
</p> | ||
|
||
<form action="/users/certification-dirigeant" method="post"> | ||
<input type="hidden" name="_csrf" value="<%= csrfToken; %>" /> | ||
|
||
<div class="fr-connect-group"> | ||
<button class="fr-connect"> | ||
<span class="fr-connect__login">S’identifier avec</span> | ||
<span class="fr-connect__brand">FranceConnect</span> | ||
</button> | ||
<p> | ||
<a | ||
href="https://franceconnect.gouv.fr/" | ||
target="_blank" | ||
rel="noopener" | ||
title="Qu’est-ce que FranceConnect ? - nouvelle fenêtre" | ||
>Qu’est-ce que FranceConnect ?</a | ||
> | ||
</p> | ||
</div> | ||
</form> | ||
</div> |