diff --git a/src/login/UserProfileFormFields.tsx b/src/login/UserProfileFormFields.tsx index 5c816351..df1a5fc8 100644 --- a/src/login/UserProfileFormFields.tsx +++ b/src/login/UserProfileFormFields.tsx @@ -254,7 +254,7 @@ function InputFiledByType(props: InputFiledByTypeProps) { if (attribute.name === "password" || attribute.name === "password-confirm") { return ( - + {inputNode} ); @@ -265,20 +265,15 @@ function InputFiledByType(props: InputFiledByTypeProps) { } } -function PasswordWrapper(props: { - getClassName: UserProfileFormFieldsProps["getClassName"]; - i18n: I18n; - attributeName: "password" | "password-confirm"; - children: JSX.Element; -}) { - const { getClassName, i18n, attributeName, children } = props; +function PasswordWrapper(props: { getClassName: (classKey: ClassKey) => string; i18n: I18n; passwordInputId: string; children: JSX.Element }) { + const { getClassName, i18n, passwordInputId, children } = props; const { msgStr } = i18n; const [isPasswordRevealed, toggleIsPasswordRevealed] = useReducer((isPasswordRevealed: boolean) => !isPasswordRevealed, false); useEffect(() => { - const passwordInputElement = document.getElementById(attributeName); + const passwordInputElement = document.getElementById(passwordInputId); assert(passwordInputElement instanceof HTMLInputElement); @@ -292,7 +287,7 @@ function PasswordWrapper(props: { type="button" className={getClassName("kcFormPasswordVisibilityButtonClass")} aria-label={msgStr(isPasswordRevealed ? "hidePassword" : "showPassword")} - aria-controls={attributeName} + aria-controls={passwordInputId} onClick={toggleIsPasswordRevealed} > , I18n>) { const { kcContext, i18n, doUseDefaultCss, Template, classes } = props; @@ -26,57 +28,59 @@ export default function Login(props: PageProps -
- - {msg("noAccount")}{" "} - - {msg("doRegister")} - - -
- + <> + {realm.password && realm.registrationAllowed && !registrationDisabled && ( +
+
+ + {msg("noAccount")}{" "} + + {msg("doRegister")} + + +
+
+ )} + } socialProvidersNode={ - realm.password && - social.providers && ( -
-
-

{msg("identity-provider-login-label")}

- - -
- ) + <> + {realm.password && social.providers?.length && ( +
+
+

{msg("identity-provider-login-label")}

+ +
+ )} + } >
@@ -86,7 +90,6 @@ export default function Login(props: PageProps { setIsLoginButtonDisabled(true); - return true; }} action={url.loginAction} @@ -101,7 +104,6 @@ export default function Login(props: PageProps - - {messagesPerField.existsError("username", "password") && ( {messagesPerField.getFirstError("username", "password")} @@ -126,8 +127,7 @@ export default function Login(props: PageProps {msg("password")} - -
+ - -
- + {usernameHidden && messagesPerField.existsError("username", "password") && ( {messagesPerField.getFirstError("username", "password")} )}
+
{realm.rememberMe && !usernameHidden && (
@@ -184,10 +172,12 @@ export default function Login(props: PageProps
+
- +
)}
-