From 5d76bb2d65e3117915e6c86b232b6a458dc07d1c Mon Sep 17 00:00:00 2001 From: Florian Trayon <26360935+FlorianLeChat@users.noreply.github.com> Date: Mon, 4 Mar 2024 21:30:51 +0100 Subject: [PATCH] Improved HTML form checks in modal decryption key window --- .../dashboard/components/file-history.tsx | 2 +- .../dashboard/components/request-key.tsx | 72 ++++++++----------- .../dashboard/components/row-actions.tsx | 2 +- 3 files changed, 33 insertions(+), 43 deletions(-) diff --git a/app/[locale]/dashboard/components/file-history.tsx b/app/[locale]/dashboard/components/file-history.tsx index 9331639..9702a55 100644 --- a/app/[locale]/dashboard/components/file-history.tsx +++ b/app/[locale]/dashboard/components/file-history.tsx @@ -211,7 +211,7 @@ export default function FileHistory( { {/* Accès au fichier */} {version.encrypted ? ( - + ( null ); + const base = new URL( url, window.location.href ); + const parameters = base.searchParams; // Affichage du rendu HTML du composant. return ( @@ -58,48 +56,40 @@ export default function RequestKey( { - - { - // Mise à jour de l'entrée utilisateur. - setPassword( event.currentTarget.value ); - }} - onKeyDown={( event ) => - { - // Soumission du formulaire par clavier. - if ( event.key.endsWith( "Enter" ) ) - { - access.current?.click(); - } - }} - spellCheck="false" - placeholder="your_key" - autoComplete="off" - autoCapitalize="off" - /> +
+ {/* Version d'un fichier */} + {parameters.get( "v" ) && ( + + )} + + {/* Clé de déchiffrement */} + +
- + Annuler - - { - // Ouverture de la version dans un nouvel onglet. - window.open( - new URL( - `${ url }${ password }`, - window.location.href - ).href, - "_blank", - "noopener,noreferrer" - ); - }} - disabled={!password} - > + Accéder diff --git a/app/[locale]/dashboard/components/row-actions.tsx b/app/[locale]/dashboard/components/row-actions.tsx index 5cabbf2..890e053 100644 --- a/app/[locale]/dashboard/components/row-actions.tsx +++ b/app/[locale]/dashboard/components/row-actions.tsx @@ -612,7 +612,7 @@ export default function RowActions( { {/* Accès à la ressource */} {dataFiles[ 0 ].versions[ 0 ].encrypted ? ( - +