diff --git a/api/src/services/affiliation.service.ts b/api/src/services/affiliation.service.ts index b54e538..4fc340a 100644 --- a/api/src/services/affiliation.service.ts +++ b/api/src/services/affiliation.service.ts @@ -4,7 +4,7 @@ import {SecurityBindings, UserProfile} from '@loopback/security'; import {capitalize} from 'lodash'; -import {WEBSITE_FQDN} from '../constants'; +import {IDP_FQDN, realmName, WEBSITE_FQDN} from '../constants'; import {Affiliation, Citizen, User, Enterprise, Funder} from '../models'; import { AffiliationRepository, @@ -59,7 +59,7 @@ export class AffiliationService { * @param enterpriseEmails[]: string[] - email patterns of the enterprise citizen want to be member */ isValidEmailProPattern(emailCitizen: string, enterpriseEmails: string[]): Boolean { - return enterpriseEmails.includes(emailCitizen.replace(/^.+@/, '@')); + return enterpriseEmails.map(email => email.toLowerCase()).includes(emailCitizen.replace(/^.+@/, '@').toLowerCase()); } /** @@ -178,7 +178,7 @@ export class AffiliationService { * @param enterpriseName entreprise to be affiliated to */ async sendValidatedAffiliation(citizen: Citizen, enterpriseName: string) { - const websiteLink = `${WEBSITE_FQDN}/recherche`; + const websiteLink = `${IDP_FQDN}/auth/realms/${realmName}/protocol/openid-connect/auth?client_id=platform&redirect_uri=${WEBSITE_FQDN}/recherche&response_mode=fragment&response_type=code`; await this.mailService.sendMailAsHtml( citizen.personalInformation.email.value!, "Votre demande d'affiliation a été acceptée !", diff --git a/api/src/services/citizen.service.ts b/api/src/services/citizen.service.ts index 1af3cb5..005c87d 100644 --- a/api/src/services/citizen.service.ts +++ b/api/src/services/citizen.service.ts @@ -605,7 +605,7 @@ export class CitizenService { // Send a manual affiliation mail to the company's funders accepting the manual affiliation or to citizen if (affiliation.status === AFFILIATION_STATUS.TO_AFFILIATE) { - if (enterprise!.enterpriseDetails.hasManualAffiliation) { + if (enterprise!.enterpriseDetails.hasManualAffiliation && !citizen.affiliation.enterpriseEmail) { await this.affiliationService.sendManualAffiliationMail(citizen, enterprise!); Logger.info( CitizenService.name, diff --git a/idp/mcm_template/login/info.ftl b/idp/mcm_template/login/info.ftl index 65f53eb..5b7c604 100644 --- a/idp/mcm_template/login/info.ftl +++ b/idp/mcm_template/login/info.ftl @@ -19,7 +19,8 @@

${kcSanitize(msg("activeAccountDescription2"))?no_esc}

${kcSanitize(msg("btnLogIn"))?no_esc} -
+
+

${kcSanitize(msg("activeAccountDescription3"))?no_esc}

<#else> <#if pageRedirectUri?has_content>

${kcSanitize(msg("backToApplication"))?no_esc}

diff --git a/idp/mcm_template/login/messages/messages_fr.properties b/idp/mcm_template/login/messages/messages_fr.properties index 33b1329..c6a1287 100644 --- a/idp/mcm_template/login/messages/messages_fr.properties +++ b/idp/mcm_template/login/messages/messages_fr.properties @@ -309,6 +309,7 @@ passwordPolicy5=un caract\u00e8re sp\u00e9cial: \u0040\u0023\u0024\u0025\u005E\u activeAccount=Votre compte est d\u00e9sormais actif. activeAccountDescription1=Vous pouvez d\u00e9s \u00e0 pr\u00e9sent acc\u00e9der \u00e0 l''ensemble des fonctionnalit\u00e9s propos\u00e9es par Mon Compte Mobilit\u00e9 ! activeAccountDescription2=Connectez-vous \u00e0 l''aide du lien ci-dessous afin de g\u00e9rer votre compte et consulter les informations relatives \u00e0 votre profil et territoire. +activeAccountDescription3=Si vous avez pr\u00e9cis\u00e9 un mail professionnel, consultez ce dernier pour activer votre affiliation employeur. Cette affiliation est n\u00e9cessaire pour consulter les aides sp\u00e9cifiques propos\u00e9es par ce dernier. #Custom MCM message key for OAuth concent page consentProfile=Acc\u00e8s aux donn\u00e9es de votre profil diff --git a/website/src/components/Profile/Profile.tsx b/website/src/components/Profile/Profile.tsx index b1e9dcb..7b89bb9 100644 --- a/website/src/components/Profile/Profile.tsx +++ b/website/src/components/Profile/Profile.tsx @@ -415,7 +415,7 @@ const Profile: FC = ({ crumbs }) => {
) : ( - Strings['profile.phrase.not.affiliated'] + Strings['profile.phrase.not.affiliated.waiting'] ) ) : ( UserAffiliationStatus[ diff --git a/website/src/components/Profile/locale/fr.json b/website/src/components/Profile/locale/fr.json index fd3bc8f..204034b 100644 --- a/website/src/components/Profile/locale/fr.json +++ b/website/src/components/Profile/locale/fr.json @@ -44,6 +44,7 @@ "profile.label.gender.male": "M.", "profile.label.gender.female": "Mme.", "profile.phrase.not.affiliated": "Non Affilié", + "profile.phrase.not.affiliated.waiting": "En cours de validation par votre employeur", "profile.tooltip.linked.accounts": "Rendez-vous sur votre application régionale de mobilité pour lier vos comptes et profiter de l'ensemble des fonctionnalités MOB", "profile.tooltip.refresh.page": "Veuillez rafraîchir cette page pour visualiser le changement de statut", "profile.modal.validate.button": "Valider ma désaffiliation", diff --git a/website/src/components/Profile/locale/fr.json.d.ts b/website/src/components/Profile/locale/fr.json.d.ts index 16ed452..4b4e542 100644 --- a/website/src/components/Profile/locale/fr.json.d.ts +++ b/website/src/components/Profile/locale/fr.json.d.ts @@ -44,6 +44,7 @@ interface Fr { 'profile.label.gender.female': string; 'profile.label.gender.male': string; 'profile.phrase.not.affiliated': string; + 'profile.phrase.not.affiliated.waiting': string; 'profile.tooltip.linked.accounts': string; 'profile.tooltip.refresh.page': string; 'profile.modal.validate.button': string; diff --git a/website/src/components/Tabs/Tabs.tsx b/website/src/components/Tabs/Tabs.tsx index 48d3456..ca12010 100644 --- a/website/src/components/Tabs/Tabs.tsx +++ b/website/src/components/Tabs/Tabs.tsx @@ -1,4 +1,4 @@ -import React, { FC, useState } from 'react'; +import React, { FC, useEffect, useState } from 'react'; import classNames from 'classnames'; import './_tabs.scss'; @@ -19,6 +19,9 @@ const Tab: FC = ({ tabs, setSelectedIndex, defaultActiveTab }) => { const [activeTab, setActiveTab] = useState( defaultActiveTab || tabs[0]?.id ); + useEffect(() => { + setActiveTab(defaultActiveTab || tabs[0]?.id) + }, [defaultActiveTab]) const handleTabClick = (tabID: React.SetStateAction) => { setActiveTab(tabID); diff --git a/website/src/components/Toast/Toast.tsx b/website/src/components/Toast/Toast.tsx index a4c0b99..83cf3e2 100644 --- a/website/src/components/Toast/Toast.tsx +++ b/website/src/components/Toast/Toast.tsx @@ -28,10 +28,10 @@ const toastOptions = { }, }; const containerStyle = { - top: 0, + top: "115px", left: 0, bottom: 0, - right: 0, + right: 0 }; const Toast: FC = () => { diff --git a/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx b/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx index 15dbbd2..e7fe59a 100644 --- a/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx +++ b/website/src/modules/inscription/components/affiliate/AffiliateSuccessMessage.tsx @@ -5,6 +5,8 @@ import Button from '@components/Button/Button'; import { useSession } from '../../../../context'; import Strings from '../../locale/fr.json'; +import { navigate } from 'gatsby'; +import { INCENTIVE_TYPE } from '../../../../utils/demandes'; const AffiliateSuccessMessage: FC = () => { const { isKCInit, keycloak } = useSession(); @@ -26,6 +28,12 @@ const AffiliateSuccessMessage: FC = () => { {Strings['affiliation.success.button']} )} + {isKCInit && keycloak?.authenticated && ( + // User is logged in, invite them to go to incentives page + + )} ); }; diff --git a/website/src/modules/inscription/locale/fr.json b/website/src/modules/inscription/locale/fr.json index e116e41..b16f2ba 100644 --- a/website/src/modules/inscription/locale/fr.json +++ b/website/src/modules/inscription/locale/fr.json @@ -6,6 +6,7 @@ "affiliation.success": "Félicitations ! Vous êtes désormais affilié à votre employeur.", "affiliation.success.action": "Si vous avez activé votre compte, vous pouvez désormais vous connecter pour visualiser les aides de votre employeur.", "affiliation.success.button": "Me connecter", + "affiliation.success.button.incentives": "Consulter mes aides employeur", "affiliation.title": "Vous avez demandé une affiliation", "affiliation.button": "Affilier mon compte", "affiliation.profile": "Mon profil", diff --git a/website/src/modules/inscription/locale/fr.json.d.ts b/website/src/modules/inscription/locale/fr.json.d.ts index 78ff2e3..f278f4d 100644 --- a/website/src/modules/inscription/locale/fr.json.d.ts +++ b/website/src/modules/inscription/locale/fr.json.d.ts @@ -6,6 +6,7 @@ interface Fr { 'affiliation.success': string; 'affiliation.success.action': string; 'affiliation.success.button': string; + 'affiliation.success.button.incentives': string; 'affiliation.title': string; 'affiliation.button': string; 'affiliation.profile': string; diff --git a/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx b/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx index b2784b3..dcc66b8 100644 --- a/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx +++ b/website/src/modules/inscription/pages/InscriptionPageAffiliation.tsx @@ -24,11 +24,13 @@ import { StatusCode } from '@utils/https'; import { matomoTrackEvent } from '@utils/matomo'; import { useMatomo } from '@datapunt/matomo-tracker-react'; +import { useUser } from '../../../context'; import Strings from '../locale/fr.json'; const InscriptionPageAffiliation: FC = () => { const [token] = useQueryParam('token', StringParam); const { trackEvent } = useMatomo(); + const { citizen, refetchCitizen } = useUser(); const { error, refetch, isIdle, isLoading, isSuccess, isError } = useQuery( 'affiliate', async () => { @@ -50,8 +52,11 @@ const InscriptionPageAffiliation: FC = () => { } }, []); - const handleClick = (): void => { - refetch(); + const handleClick = async (): Promise => { + await refetch(); + if (citizen) { + refetchCitizen(); + } }; const renderMessage = (): React.ReactNode => { diff --git a/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx b/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx index 46dbb55..5ed5449 100644 --- a/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx +++ b/website/src/modules/mon-dashboard/pages/GererSalaries/gererSalaries.tsx @@ -204,7 +204,7 @@ const GererSalaries: FC = ({ location, pageContext }) => { const renderSalaries = (): ReactNode => { if (salaries && salaries.length) { return salaries.map( - ({ id, firstName, lastName, enterpriseEmail, email, birthDate }) => { + ({ id, firstName, lastName, enterpriseEmail, email, birthdate }) => { return ( @@ -222,7 +222,7 @@ const GererSalaries: FC = ({ location, pageContext }) => { .

+ + + ), { + style: { + minWidth: '50%', + } + }) + } + return toast.dismiss + }, []) + useEffect(() => { if (allIncentivesCount) { setIncentivesCount((previousState) => ({ @@ -413,6 +432,9 @@ const RechercheComponent: FC = ({ pageContext }) => { ...previousState, employerIncentives: employerIncentivesCount?.count, })); + if (employerIncentivesCount?.count > 0 && !routeSelectedTab) { + setSelectedTab(INCENTIVE_TYPE.EMPLOYER_INCENTIVE) + } } }, [employerIncentivesCount]); @@ -433,7 +455,7 @@ const RechercheComponent: FC = ({ pageContext }) => { territoryFilter, transportsFilter, ]); - + return ( { - this.showToaster(); + //this.showToaster(); return injectToken(config); }, (error) => Promise.reject(error) @@ -69,11 +69,11 @@ class Https { https.interceptors.response.use( (response) => { - this.dismissToaster(); + //this.dismissToaster(); return response; }, (error) => { - this.dismissToaster(); + //this.dismissToaster(); const { response } = error; return this.handleError(response); }