Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
modal information TBP migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ornella452 committed Jun 11, 2024
1 parent a4035fe commit b4c072e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/anonymous/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function Login() {
{showModalVerifyCode &&
<ModalVerifyCode setShowModalVerifyCode={setShowModalVerifyCode} email={username} />
}
{role === 'structure' &&
{['admin', 'structure', 'hub'].includes(role ?? error?.role) &&
<dialog aria-labelledby="fr-modal-confirm-siret" role="dialog" id="fr-modal-confirm-siret" className="fr-modal modalOpened">
<div className="fr-container fr-container--fluid fr-container-md">
<div className="fr-grid-row fr-grid-row--center">
Expand All @@ -124,7 +124,7 @@ function Login() {
<div className="fr-modal__header"></div>
<div className="fr-modal__content">
<h1 id="fr-modal-title-modal-1" className="fr-modal__title">
A partir de maintenant l&rsquo;espace Coop structure &eacute;volue et devient &quot;Le tableau de pilotage&quot;
A partir de maintenant l&rsquo;espace Coop {role ?? error?.role} &eacute;volue et devient &quot;Le tableau de pilotage&quot;
</h1>
<p>
<strong>Pourquoi un changement de nom et d&rsquo;interface ?</strong><br />
Expand Down
6 changes: 5 additions & 1 deletion src/services/user.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ function handleResponse(response) {
const rolesAllowed = ['conseiller', 'admin_coop', 'hub_coop'];
if (rolesAllowed.filter(role => roles.includes(role)).length === 0) {
logout();
return Promise.reject({ error: 'Identifiants incorrects' });
const roleNotAllowed = roles.find(role => ['admin', 'structure', 'hub'].includes(role));
if (roleNotAllowed) {
window.location.href = `/login?role=${roleNotAllowed}`;
}
return Promise.reject({ error: 'Vous n\'avez pas accès à cette application' });
}
if (data.user?.passwordCreated === false) {
logout();
Expand Down

0 comments on commit b4c072e

Please sign in to comment.