mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-25 22:08:46 +00:00
fix(login): use onChange instead of onBlur with react-hook-form (#11354)
# Which Problems Are Solved Fixes a problem where submit buttons where not correctly enabled onBlur event # How the Problems Are Solved By changing the react-hook-form mode property to onChange, buttons are enabled as intended
This commit is contained in:
@@ -27,17 +27,9 @@ type Props = {
|
||||
allowRegister: boolean;
|
||||
};
|
||||
|
||||
export function UsernameForm({
|
||||
loginName,
|
||||
requestId,
|
||||
organization,
|
||||
suffix,
|
||||
loginSettings,
|
||||
submit,
|
||||
allowRegister,
|
||||
}: Props) {
|
||||
export function UsernameForm({ loginName, requestId, organization, suffix, loginSettings, submit, allowRegister }: Props) {
|
||||
const { register, handleSubmit, formState } = useForm<Inputs>({
|
||||
mode: "onBlur",
|
||||
mode: "onChange",
|
||||
defaultValues: {
|
||||
loginName: loginName ? loginName : "",
|
||||
},
|
||||
@@ -87,10 +79,7 @@ export function UsernameForm({
|
||||
}, []);
|
||||
|
||||
let inputLabel = t("labels.loginname");
|
||||
if (
|
||||
loginSettings?.disableLoginWithEmail &&
|
||||
loginSettings?.disableLoginWithPhone
|
||||
) {
|
||||
if (loginSettings?.disableLoginWithEmail && loginSettings?.disableLoginWithPhone) {
|
||||
inputLabel = t("labels.username");
|
||||
} else if (loginSettings?.disableLoginWithEmail) {
|
||||
inputLabel = t("labels.usernameOrPhoneNumber");
|
||||
|
||||
Reference in New Issue
Block a user