fix: improve auth form semantics

This commit is contained in:
Thomas Camlong committed 2026-08-14 21:22:14 +02:00
1 parent 409e8ed71a
commit 2e3e654748
2 files changed
+23 -4

No files matched your search

@@ -62,13 +62,16 @@ export const RegistrationForm = ({ invite }: RegistrationFormProps) => {
return ( return (
<Stack gap="xl"> <Stack gap="xl">
<form onSubmit={form.onSubmit(handleSubmit)}> <form autoComplete="on" onSubmit={form.onSubmit(handleSubmit)}>
<Stack gap="lg"> <Stack gap="lg">
<TextInput <TextInput
label={t("field.username.label")} label={t("field.username.label")}
id="username" id="username"
autoComplete="username" autoComplete="username"
autoCapitalize="none"
spellCheck={false}
{...form.getInputProps("username")} {...form.getInputProps("username")}
name="username"
/> />
<CustomPasswordInput <CustomPasswordInput
withPasswordRequirements withPasswordRequirements
@@ -76,6 +79,7 @@ export const RegistrationForm = ({ invite }: RegistrationFormProps) => {
id="password" id="password"
autoComplete="new-password" autoComplete="new-password"
{...form.getInputProps("password")} {...form.getInputProps("password")}
name="password"
/> />
<PasswordInput <PasswordInput
@@ -83,6 +87,7 @@ export const RegistrationForm = ({ invite }: RegistrationFormProps) => {
id="password-confirm" id="password-confirm"
autoComplete="new-password" autoComplete="new-password"
{...form.getInputProps("confirmPassword")} {...form.getInputProps("confirmPassword")}
name="password-confirmation"
/> />
<Button type="submit" fullWidth loading={isPending}> <Button type="submit" fullWidth loading={isPending}>
{t("action.register.label")} {t("action.register.label")}
@@ -116,19 +116,26 @@ export const LoginForm = ({ providers, oidcClientName, isOidcAutoLoginEnabled, c
<Stack gap="lg"> <Stack gap="lg">
{credentialInputsVisible && ( {credentialInputsVisible && (
<> <>
<form onSubmit={form.onSubmit((credentials) => void signInAsync(credentials.provider, credentials))}> <form
autoComplete="on"
onSubmit={form.onSubmit((credentials) => void signInAsync(credentials.provider, credentials))}
>
<Stack gap="lg"> <Stack gap="lg">
<TextInput <TextInput
label={t("field.username.label")} label={t("field.username.label")}
id="username" id="username"
autoComplete="username" autoComplete="username"
autoCapitalize="none"
spellCheck={false}
{...form.getInputProps("name")} {...form.getInputProps("name")}
name="username"
/> />
<PasswordInput <PasswordInput
label={t("field.password.label")} label={t("field.password.label")}
id="password" id="password"
autoComplete="current-password" autoComplete="current-password"
{...form.getInputProps("password")} {...form.getInputProps("password")}
name="password"
/> />
{providers.includes("credentials") && ( {providers.includes("credentials") && (
@@ -152,7 +159,13 @@ export const LoginForm = ({ providers, oidcClientName, isOidcAutoLoginEnabled, c
)} )}
{providers.includes("oidc") && ( {providers.includes("oidc") && (
<Button fullWidth variant="light" disabled={!isMounted} onClick={async () => await signInAsync("oidc")}> <Button
type="button"
fullWidth
variant="light"
disabled={!isMounted || isPending}
onClick={() => void signInAsync("oidc")}
>
{t("action.login.labelWith", { provider: oidcClientName })} {t("action.login.labelWith", { provider: oidcClientName })}
</Button> </Button>
)} )}
@@ -174,7 +187,8 @@ const SubmitButton = ({ isMounted, isPending, form, provider, children }: PropsW
return ( return (
<Button <Button
type="submit" type="submit"
name={provider} name="provider"
value={provider}
fullWidth fullWidth
onClick={() => form.setFieldValue("provider", provider)} onClick={() => form.setFieldValue("provider", provider)}
loading={isPending && isCurrentProviderActive} loading={isPending && isCurrentProviderActive}