mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
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:
parent
6928a2bd98
commit
bf08a04cda
11 changed files with 53 additions and 112 deletions
|
|
@ -26,9 +26,13 @@ const RequestPasswordResetForm = ({ onSubmit, skipTokenRequest }) => {
|
|||
setIsMFA(true);
|
||||
}, ServerTypes.RESET_PASSWORD_CHALLENGE, []);
|
||||
|
||||
const handleOnSubmit = (form) => {
|
||||
const handleOnSubmit = ({ userName, email, ...values }) => {
|
||||
setErrorMessage(false);
|
||||
onSubmit(form);
|
||||
|
||||
userName = userName?.trim();
|
||||
email = email?.trim();
|
||||
|
||||
onSubmit({ userName, email, ...values });
|
||||
}
|
||||
|
||||
const validate = values => {
|
||||
|
|
@ -63,7 +67,7 @@ const RequestPasswordResetForm = ({ onSubmit, skipTokenRequest }) => {
|
|||
</div>
|
||||
{isMFA ? (
|
||||
<div className="RequestPasswordResetForm-item">
|
||||
<Field label="Email" name="email" component={InputField} autoComplete="email" />
|
||||
<Field label="Email" name="email" type="email" component={InputField} autoComplete="email" />
|
||||
<div>Server has multi-factor authentication enabled</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue