Webatrice: tech debt (#4560)

* turn autocomplete off by default on inputs

* trim input fields onSubmit

* move trim to form submit

* cleanup

* remove dead code

* protect trim against null values

* make password optional on Login for servers that allow unregisted logins

* cleanup

Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
Jeremy Letto 2022-02-06 10:41:02 -06:00 committed by GitHub
parent 6928a2bd98
commit bf08a04cda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 53 additions and 112 deletions

View file

@ -33,6 +33,13 @@ const KnownHostForm = ({ host, onRemove, onSubmit }) => {
}
};
const handleOnSubmit = ({ name, host, ...values }) => {
name = name?.trim();
host = host?.trim();
onSubmit({ name, host, ...values });
}
return (
<Form
initialValues={{
@ -41,7 +48,7 @@ const KnownHostForm = ({ host, onRemove, onSubmit }) => {
host: host?.host,
port: host?.port,
}}
onSubmit={onSubmit}
onSubmit={handleOnSubmit}
validate={validate}
>
{({ handleSubmit }) => (