From cec35f3b6d8c10b88f6a164177eeb9fe9269b620 Mon Sep 17 00:00:00 2001 From: AntoninoP Date: Fri, 12 Jul 2024 11:30:29 +0200 Subject: [PATCH] input check --- src/components/CreateServer/CreateServer.jsx | 8 ++++++-- src/pages/ServerDetails/ServerDetails.jsx | 11 +++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/CreateServer/CreateServer.jsx b/src/components/CreateServer/CreateServer.jsx index 2bdd9a6..443e622 100644 --- a/src/components/CreateServer/CreateServer.jsx +++ b/src/components/CreateServer/CreateServer.jsx @@ -45,6 +45,10 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer } }; + const validateInput = (input) => { + return input.replace(/[^a-zA-Z]/g, ''); + }; + return (
{noServers ? ( @@ -67,7 +71,7 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer className={styles.inputsubdomain} type="text" value={subdomainInput} - onChange={(e) => setSubdomainInput(e.target.value)} + onChange={(e) => setSubdomainInput(validateInput(e.target.value))} placeholder='Nom du sous domaine' />