diff --git a/src/app/(dashboard)/assign-zone-project/AssignProject.jsx b/src/app/(dashboard)/assign-zone-project/AssignProject.jsx index 55660685e12137e733a32d1c931aebc826531736..792edec5407ce879c22abf0ee134f46b3d1d5108 100644 --- a/src/app/(dashboard)/assign-zone-project/AssignProject.jsx +++ b/src/app/(dashboard)/assign-zone-project/AssignProject.jsx @@ -338,7 +338,7 @@ const AssignProject = ({ setIsOpen, listProjects, affectations, mutateProjectAff {((collabsAttributed - places.length) > 0) &&
-

Veuillez sélectionner une autre zonne pour compléter l'affectation (optionnel)

+

Veuillez sélectionner une autre zonne pour compléter l'affectation (optionnel)

handleOtherZoneSelection(e)} className='flex-1 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none'> diff --git a/src/app/(dashboard)/assign-zone-project/page.jsx b/src/app/(dashboard)/assign-zone-project/page.jsx index f3e0a85c02405dc0dd284f6aa272ee568ff2def9..599a69af23712f9606eea091121235572f3a701d 100644 --- a/src/app/(dashboard)/assign-zone-project/page.jsx +++ b/src/app/(dashboard)/assign-zone-project/page.jsx @@ -265,7 +265,7 @@ const AffectingZoneProject = () => { {isLoadingListProjects &&
} {!isLoadingListProjects && <> {(!isArray(listProjectsAffected) || listProjectsAffected?.length === 0) ?
-

Aucune Affectation n'a été trouvé.

+

Aucune Affectation n'a été trouvé.

:
@@ -310,7 +310,7 @@ const AffectingZoneProject = () => { { (listProjectsSemiAffected && listProjectsSemiAffected.length) ?
: @@ -320,7 +320,7 @@ const AffectingZoneProject = () => { isOpen={isModalOpen} onClose={() => setModalOpen(false)} onConfirm={handleConfirmDelete} - message={`Êtes-vous sûr de vouloir supprimer l'affectation "${selectedAffectaionToDelete?.id_project.nom}"?`} + message={`Êtes-vous sûr de vouloir supprimer l'affectation "${selectedAffectaionToDelete?.id_project.nom}"?`} /> diff --git a/src/app/(dashboard)/consultation-reservations/page.jsx b/src/app/(dashboard)/consultation-reservations/page.jsx index a1ce7ba0ae266e40c204a52e2284fe445b3414d1..2dea09c625ee78485815ff71c53221d3fbe66172 100644 --- a/src/app/(dashboard)/consultation-reservations/page.jsx +++ b/src/app/(dashboard)/consultation-reservations/page.jsx @@ -435,7 +435,7 @@ const Reservation = () => { {(!isLoadingData && !selectedZoneData) &&

Vous êtes en télétravail - aujourd'hui.

+ aujourd'hui.

} diff --git a/src/app/(dashboard)/etage/CreateEtage.jsx b/src/app/(dashboard)/etage/CreateEtage.jsx index 4e27ebc279ca63b9aaf88aa8e7b5577adde6608e..91ac78dda1d7f9ba54019161dae0fa3fd9db7183 100644 --- a/src/app/(dashboard)/etage/CreateEtage.jsx +++ b/src/app/(dashboard)/etage/CreateEtage.jsx @@ -170,7 +170,7 @@ const CreateEtage = ({ appendEtage, cancelCreate }) => {

{Math.round((image.size / (1024 * 1024)) * 100) / 100}Mo

-

Voir l'image

+

Voir l'image

{(isDisplayingImage) &&
diff --git a/src/app/(dashboard)/etage/EtageTableRow.jsx b/src/app/(dashboard)/etage/EtageTableRow.jsx index eb44b096e9415a0ade6ec91efee3e11ad30d4a27..5d9de27c6d13b6dac8dfa155133a5321b5ff75c6 100644 --- a/src/app/(dashboard)/etage/EtageTableRow.jsx +++ b/src/app/(dashboard)/etage/EtageTableRow.jsx @@ -215,7 +215,7 @@ const EtageTableRow = ({ id, numero, setEtages, image: etageImage }) => { {(imageAttributs.size) &&

{Math.round((imageAttributs.size / (1024 * 1024)) * 100) / 100}Mo

}
-

Voir l'image

+

Voir l'image

@@ -227,10 +227,10 @@ const EtageTableRow = ({ id, numero, setEtages, image: etageImage }) => { } } {(!image && !isUpdating) &&

- Aucune image n'est associée à cet étage. + Aucune image n'est associée à cet étage.

} {(image && !isUpdating) &&
-

Voir l'image

+

Voir l'image

}
diff --git a/src/app/(dashboard)/etage/EtagesFilter.jsx b/src/app/(dashboard)/etage/EtagesFilter.jsx index 406e6e3cdbaa2d7b5d0f35b5f162525646883319..f91f7d51fe462393bb71c12f5e60cceb74c7e2ce 100644 --- a/src/app/(dashboard)/etage/EtagesFilter.jsx +++ b/src/app/(dashboard)/etage/EtagesFilter.jsx @@ -14,7 +14,7 @@ const EtagesFilter = memo(function page({ setFilter, filter }) {

Recherche

- +
diff --git a/src/app/(dashboard)/etage/page.jsx b/src/app/(dashboard)/etage/page.jsx index 59ac933a3f717494a0eb7b4b39991dc001ea7a2b..972dd156f9d53635d5c9e5b7997be1d41937ece2 100644 --- a/src/app/(dashboard)/etage/page.jsx +++ b/src/app/(dashboard)/etage/page.jsx @@ -41,13 +41,13 @@ const Etage = () => { {isLoading &&
} {!isLoading && <> {(!isArray(etages) || etages?.length === 0) ?
-

Aucun étage n'a été trouvée.

+

Aucun étage n'a été trouvée.

:
- + {(isCreating) && setIsCreating(false)} appendEtage={appendEtage} />} diff --git a/src/app/(dashboard)/place/page.jsx b/src/app/(dashboard)/place/page.jsx index 08c1014fbc4cb4d318103c60db2fde98dd97f708..3533112880f59e0d6ebc049bf7a63fb3f938536f 100644 --- a/src/app/(dashboard)/place/page.jsx +++ b/src/app/(dashboard)/place/page.jsx @@ -120,7 +120,7 @@ const Place = () => { {isLoading &&
} {!isLoading && <> {(!isArray(places) || places?.length === 0) ?
-

Aucune Place n'a été trouvé.

+

Aucune Place n'a été trouvé.

:
Numéro ÉtageL'image de l'étageL'image de l'étage Actions
diff --git a/src/app/(dashboard)/privilege/PrivilegesFilter.jsx b/src/app/(dashboard)/privilege/PrivilegesFilter.jsx index d251f0ec25a7bdee631202c022a730d0e4513a0a..bf8df54e027b0b9fbada674ebd0224ddd090418b 100644 --- a/src/app/(dashboard)/privilege/PrivilegesFilter.jsx +++ b/src/app/(dashboard)/privilege/PrivilegesFilter.jsx @@ -14,7 +14,7 @@ const PrivilegesFilter = memo(function page({ setFilter, filter }) {

Recherche

- +
diff --git a/src/app/(dashboard)/privilege/page.jsx b/src/app/(dashboard)/privilege/page.jsx index c05236641540fecb8cca8f975cd417af7e901455..49acf4ebdae20d19403bcd041c4b072fb7618fa4 100644 --- a/src/app/(dashboard)/privilege/page.jsx +++ b/src/app/(dashboard)/privilege/page.jsx @@ -41,7 +41,7 @@ const Privilege = () => { {isLoading &&
} {!isLoading && <> {(!isArray(privileges) || privileges?.length === 0) ?
-

Aucune habilitation n'a été trouvée.

+

Aucune habilitation n'a été trouvée.

:
diff --git a/src/app/(dashboard)/projects/ProjectForm.jsx b/src/app/(dashboard)/projects/ProjectForm.jsx index 40e29d1d391b85bcc183b16971c8b802108a1446..e732f3743549ba3823a7f08d94f68c1475c814cd 100644 --- a/src/app/(dashboard)/projects/ProjectForm.jsx +++ b/src/app/(dashboard)/projects/ProjectForm.jsx @@ -189,7 +189,7 @@ const ProjectForm = ({setIsOpen, onAddProject, onEditProject, editingProject, se
{userIds.map((user, index) => ( -
+

{`${user.first_name} ${user.last_name}`} ({user.role.name})

diff --git a/src/app/(dashboard)/reservation/page.jsx b/src/app/(dashboard)/reservation/page.jsx index 422d12cc34d7b8367529011a69bc92c49d7e0c0e..c3a1a0fd47f5182b8cca86c622c99018c5d02bac 100644 --- a/src/app/(dashboard)/reservation/page.jsx +++ b/src/app/(dashboard)/reservation/page.jsx @@ -268,7 +268,7 @@ const Reservation = () => {
} {(!isLoadingData && !selectedZoneData) &&
-

Vous êtes en télétravail aujourd'hui.

+

Vous êtes en télétravail aujourd'hui.

}
diff --git a/src/app/(dashboard)/role/page.jsx b/src/app/(dashboard)/role/page.jsx index 214767ac4487f47c002c7bee4702e4b24968bc02..ccb732d1c2e384c581d2f430baab646e81855965 100644 --- a/src/app/(dashboard)/role/page.jsx +++ b/src/app/(dashboard)/role/page.jsx @@ -55,7 +55,7 @@ const Role = () => { {isLoading &&
} {!isLoading && <> {(!isArray(roles) || roles?.length === 0) ?
-

Aucun rôle n'a été trouvé.

+

Aucun rôle n'a été trouvé.

:
diff --git a/src/app/(dashboard)/table/page.jsx b/src/app/(dashboard)/table/page.jsx index 7de51af1af2f5dcd47bee61971c68bf93370f1dd..8fe605870dc912d8f2e56109b8aa747f8371ed78 100644 --- a/src/app/(dashboard)/table/page.jsx +++ b/src/app/(dashboard)/table/page.jsx @@ -87,7 +87,7 @@ const Table = () => { {isLoading &&
} {!isLoading && <> {(!isArray(tables) || tables?.length === 0) ?
-

Aucune Table n'a été trouvé.

+

Aucune Table n'a été trouvé.

:
diff --git a/src/app/(dashboard)/user/page.jsx b/src/app/(dashboard)/user/page.jsx index d032b245af5e17ad24d2292410924c5cfcf29264..ffbef5c42ab611331dbd7c2ce6f41f6fa311d6b8 100644 --- a/src/app/(dashboard)/user/page.jsx +++ b/src/app/(dashboard)/user/page.jsx @@ -67,7 +67,7 @@ const UserPage = () => { {(isLoading) &&
} {(!isLoading) && <> {(!isArray(users) || users?.length === 0) ?
-

Aucun utilisateurs n'a été trouvé

+

Aucun utilisateurs n'a été trouvé

:
diff --git a/src/app/(dashboard)/zone-project/AssignProject.jsx b/src/app/(dashboard)/zone-project/AssignProject.jsx index 3c923a83f0492ba33864c5cedcb94cf62bc572dd..4742f75f6066dd4f2b58955a85736c278d1ded4b 100644 --- a/src/app/(dashboard)/zone-project/AssignProject.jsx +++ b/src/app/(dashboard)/zone-project/AssignProject.jsx @@ -338,7 +338,7 @@ const AssignProject = ({ setIsOpen, listProjects, affectations, mutateProjectAff
{((collabsAttributed - places.length) > 0) &&
-

Veuillez sélectionner une autre zonne pour compléter l'affectation (optionnel)

+

Veuillez sélectionner une autre zonne pour compléter l'affectation (optionnel)

handleOtherZoneSelection(e)} className='flex-1 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none'> diff --git a/src/app/(dashboard)/zone-project/page.jsx b/src/app/(dashboard)/zone-project/page.jsx index c6de000c4b85d511551a4ff423579fb23a42d6e4..7bf4bde055879240ed38c3504ced6e9b9ec6f7c6 100644 --- a/src/app/(dashboard)/zone-project/page.jsx +++ b/src/app/(dashboard)/zone-project/page.jsx @@ -320,7 +320,7 @@ const AffectingZoneProject = () => { { (listProjectsSemiAffected && listProjectsSemiAffected.length) ?
: diff --git a/src/app/(dashboard)/zone/page.jsx b/src/app/(dashboard)/zone/page.jsx index 4585298c78ced256a67c50d99ed063170248dceb..c8a5426b6b335e76f376cd54536a50ac05ea48cc 100644 --- a/src/app/(dashboard)/zone/page.jsx +++ b/src/app/(dashboard)/zone/page.jsx @@ -68,7 +68,7 @@ const Zone = () => { {isLoading &&
} {!isLoading && <> {(!isArray(zones) || zones?.length === 0) ?
-

Aucune zone n'a été trouvé.

+

Aucune zone n'a été trouvé.

:
diff --git a/src/app/auth/change-password/ChangePasswordComponent.jsx b/src/app/auth/change-password/ChangePasswordComponent.jsx new file mode 100644 index 0000000000000000000000000000000000000000..ef073d022926e8a7b2e00a868c778ad4c2fa0cba --- /dev/null +++ b/src/app/auth/change-password/ChangePasswordComponent.jsx @@ -0,0 +1,133 @@ +"use client" +import fetchRequest from '@/app/lib/fetchRequest' +import Image from 'next/image' +import Link from 'next/link' +import React, {useEffect, useState} from 'react' +import {useSearchParams} from 'next/navigation' +import Loader from '@/components/Loader/Loader' +import {PASSWORD_REGEX} from '@/app/lib/constants' +import {useNotification} from '@/context/NotificationContext' +import TeambookVertical from "@/static/image/teambook-vertical.png"; + +const ChangePassword = () => { + const [isSuccess, setIsSuccess] = useState(false) + const [formErrors, setFormErrors] = useState([]) + const [password, setPassword] = useState("") + const [confirmPassword, setConfirmPassword] = useState("") + const [isLoading, setIsLoading] = useState(false) + const {toggleNotification} = useNotification() + const searchParams = useSearchParams() + + const handleChangePassword = async (event) => { + event.preventDefault() + setIsLoading(true) + let token = ""; + if (searchParams.has("token")) { + token = searchParams.get("token") + } + const {isSuccess, data, errors} = await fetchRequest(`/password_reset/confirm/?token=${token}`, { + method: "POST", + body: JSON.stringify({ + password, + token + }) + }) + if (isSuccess) { + setIsSuccess(true) + } else { + console.log(errors) + setIsLoading(false) + if (errors.type === "ValidationError") { + if (errors.detail.token) { + setFormErrors(["Le lien que vous avez utilisé pour réinitialiser votre mot de passe est invalide"]) + } else { + setFormErrors(["Le Mot de passe est invalide"]) + } + } else if (errors?.detail?.detail?.startsWith("The OTP password entered is not valid")) { + setFormErrors(["Le lien que vous avez utilisé pour réinitialiser votre mot de passe est déja utilisé"]) + } else { + toggleNotification({ + type: "error", + message: "Internal Server Error", + visible: true + }) + } + } + } + + const isEmptyFields = !password && !confirmPassword + + useEffect(() => { + let currentErrors = [] + if (password !== confirmPassword) { + currentErrors.push("Les mots de passe ne sont pas identiques.") + } + if (password.length < 8) { + currentErrors.push("Le mot de passe doit comporter au moins 8 caractères.") + } + if (!PASSWORD_REGEX.test(password)) { + currentErrors.push("Le mot de passe doit contenir au moins une lettre, un chiffre et un caractère spécial.") + } + setFormErrors(currentErrors) + }, [password, confirmPassword]) + + return ( +
+
+ +
+ {(!isSuccess) && +
+

Changer votre Mot de passe +

+
+
+ + setPassword(event.target.value)} type="password" + name="new_password1" id="new_password1" + className="w-full py-6 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none"/> +
+
+ + setConfirmPassword(event.target.value)} type="password" + name="new_password2" id="new_password2" + className="w-full py-6 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none"/> +
+
+
    +
  • Le mot de passe doit contenir au moins 8 caractères
  • +
  • Le mot de passe doit contenir au moins un chiffre
  • +
  • Le mot de passe doit contenir au moins un caractère spécial
  • +
+
+ +
    0 && !isEmptyFields ? "bg-red-100 border border-red-300 min-h-10" : ""} w-full px-3 text-xs py-3 rounded relative mt-9 list-inside list-disc`} + role="alert"> + {!isEmptyFields && formErrors.map((error, index) => { + return
  • {error}
  • + })} +
+ +
} + {(isSuccess) && ( +
+

The password has been changed!

+ log in + again? +
+ )} +
+ ) +} + +export default ChangePassword \ No newline at end of file diff --git a/src/app/auth/change-password/page.jsx b/src/app/auth/change-password/page.jsx index 235d187eb54de5f548100a684bbd91bbf4e76883..12798cacd956eec9a9c947e10d16746521a6cb64 100644 --- a/src/app/auth/change-password/page.jsx +++ b/src/app/auth/change-password/page.jsx @@ -1,125 +1,12 @@ -"use client" -import fetchRequest from '@/app/lib/fetchRequest' -import Image from 'next/image' -import Link from 'next/link' -import React, {useEffect, useState} from 'react' -import {useSearchParams} from 'next/navigation' -import Loader from '@/components/Loader/Loader' -import {PASSWORD_REGEX} from '@/app/lib/constants' -import {useNotification} from '@/context/NotificationContext' -import TeambookVertical from "@/static/image/teambook-vertical.png"; +import React, { Suspense } from 'react' +import ChangePassword from "@/app/auth/change-password/ChangePasswordComponent"; -const ChangePassword = () => { - const [isSuccess, setIsSuccess] = useState(false) - const [formErrors, setFormErrors] = useState([]) - const [password, setPassword] = useState("") - const [confirmPassword, setConfirmPassword] = useState("") - const [isLoading, setIsLoading] = useState(false) - const params = useSearchParams(); - const {toggleNotification} = useNotification() - const handleChangePassword = async (event) => { - event.preventDefault() - setIsLoading(true) - const {isSuccess, data, errors} = await fetchRequest(`/password_reset/confirm/?token=${params.get("token")}`, { - method: "POST", - body: JSON.stringify({ - password, - token: params.get("token") - }) - }) - if (isSuccess) { - setIsSuccess(true) - } else { - console.log(errors) - setIsLoading(false) - if (errors.type === "ValidationError") { - if (errors.detail.token) { - setFormErrors(["Le lien que vous avez utilisé pour réinitialiser votre mot de passe est invalide"]) - } else { - setFormErrors(["Le Mot de passe est invalide"]) - } - } else if (errors?.detail?.detail?.startsWith("The OTP password entered is not valid")) { - setFormErrors(["Le lien que vous avez utilisé pour réinitialiser votre mot de passe est déja utilisé"]) - } else { - toggleNotification({ - type: "error", - message: "Internal Server Error", - visible: true - }) - } - } - } - const isEmptyFields = !password && !confirmPassword - useEffect(() => { - var currentErrors = [] - if (password !== confirmPassword) { - currentErrors.push("Les mots de passe ne sont pas identiques.") - } - if (password.length < 8) { - currentErrors.push("Le mot de passe doit comporter au moins 8 caractères.") - } - if (!PASSWORD_REGEX.test(password)) { - currentErrors.push("Le mot de passe doit contenir au moins une lettre, un chiffre et un caractère spécial.") - } - setFormErrors(currentErrors) - }, [password, confirmPassword]) +const ChangePasswordPage = () => { return ( -
-
- -
- {(!isSuccess) && -
-

Changer votre Mot de passe -

-
-
- - setPassword(event.target.value)} type="password" - name="new_password1" id="new_password1" - className="w-full py-6 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none"/> -
-
- - setConfirmPassword(event.target.value)} type="password" - name="new_password2" id="new_password2" - className="w-full py-6 rounded-md px-3 duration-150 delay-75 focus:ring ring-offset-1 ring-sushi-200 border h-10 border-neutral-300 outline-none"/> -
-
-
    -
  • Le mot de passe doit contenir au moins 8 caractères
  • -
  • Le mot de passe doit contenir au moins un chiffre
  • -
  • Le mot de passe doit contenir au moins un caractère spécial
  • -
-
- -
    0 && !isEmptyFields ? "bg-red-100 border border-red-300 min-h-10" : ""} w-full px-3 text-xs py-3 rounded relative mt-9 list-inside list-disc`} - role="alert"> - {!isEmptyFields && formErrors.map((error, index) => { - return
  • {error}
  • - })} -
- -
} - {(isSuccess) && ( -
-

The password has been changed!

- log in - again? -
- )} -
+ Loading...}> + + ) } -export default ChangePassword \ No newline at end of file +export default ChangePasswordPage diff --git a/src/app/lib/session.js b/src/app/lib/session.js index 1eb509a2e30326ef4e345033f9811c8dc0688513..c5883f5f430db9e3598b8c7dd2c40f83958ae824 100644 --- a/src/app/lib/session.js +++ b/src/app/lib/session.js @@ -3,7 +3,6 @@ import Cookies from 'js-cookie'; import { SignJWT, jwtVerify } from 'jose' const secretKey = process.env.NEXT_PUBLIC_SESSION_SECRET; -console.log(secretKey); const encodedKey = new TextEncoder().encode(secretKey) export async function encrypt(payload) { diff --git a/src/app/ui/ReservationConfirmation.jsx b/src/app/ui/ReservationConfirmation.jsx index 7ec4532989061a06377bd22b4d0244ea0dbff54a..9f768bf19d3581136b7443df3f28ab5c996c38ec 100644 --- a/src/app/ui/ReservationConfirmation.jsx +++ b/src/app/ui/ReservationConfirmation.jsx @@ -27,7 +27,7 @@ const ReservationConfirmation = ({ isOpen, onClose, onConfirm, isLoading, reserv
-

Confirmation d'annulation de Réservation

+

Confirmation d'annulation de Réservation

Êtes-vous sûr de vouloir annuler la réservation de la place {reservationData.placeName || ""} à la table {reservationData.tableName || ""} dans la zone {reservationData.zoneName || ""}