keycloakify 9.6.7 → 10.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/account/Template.js +34 -14
- package/account/Template.js.map +1 -1
- package/account/i18n/baseMessages/de.d.ts +1 -1
- package/account/i18n/baseMessages/de.js +1 -1
- package/account/i18n/baseMessages/de.js.map +1 -1
- package/account/i18n/baseMessages/en.d.ts +2 -0
- package/account/i18n/baseMessages/en.js +2 -0
- package/account/i18n/baseMessages/en.js.map +1 -1
- package/account/i18n/baseMessages/es.d.ts +230 -0
- package/account/i18n/baseMessages/es.js +231 -1
- package/account/i18n/baseMessages/es.js.map +1 -1
- package/account/i18n/baseMessages/index.d.ts +353 -407
- package/account/i18n/baseMessages/index.js +1 -0
- package/account/i18n/baseMessages/index.js.map +1 -1
- package/account/i18n/baseMessages/pl.d.ts +115 -1
- package/account/i18n/baseMessages/pl.js +115 -1
- package/account/i18n/baseMessages/pl.js.map +1 -1
- package/account/i18n/baseMessages/tr.d.ts +1 -1
- package/account/i18n/baseMessages/tr.js +1 -1
- package/account/i18n/baseMessages/tr.js.map +1 -1
- package/account/i18n/baseMessages/uk.d.ts +337 -0
- package/account/i18n/baseMessages/uk.js +342 -0
- package/account/i18n/baseMessages/uk.js.map +1 -0
- package/account/i18n/baseMessages/zh-CN.d.ts +10 -0
- package/account/i18n/baseMessages/zh-CN.js +10 -0
- package/account/i18n/baseMessages/zh-CN.js.map +1 -1
- package/bin/constants.d.ts +0 -1
- package/bin/constants.js +1 -2
- package/bin/constants.js.map +1 -1
- package/bin/keycloakify/buildJars/buildJar.d.ts +14 -0
- package/bin/keycloakify/buildJars/buildJar.js +216 -0
- package/bin/keycloakify/buildJars/buildJar.js.map +1 -0
- package/bin/keycloakify/buildJars/buildJars.d.ts +10 -0
- package/bin/keycloakify/buildJars/buildJars.js +95 -0
- package/bin/keycloakify/buildJars/buildJars.js.map +1 -0
- package/bin/keycloakify/buildJars/extensionVersions.d.ts +12 -0
- package/bin/keycloakify/buildJars/extensionVersions.js +7 -0
- package/bin/keycloakify/buildJars/extensionVersions.js.map +1 -0
- package/bin/keycloakify/buildJars/generatePom.d.ts +13 -0
- package/bin/keycloakify/buildJars/generatePom.js +94 -0
- package/bin/keycloakify/buildJars/generatePom.js.map +1 -0
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +6 -0
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +35 -0
- package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +1 -0
- package/bin/keycloakify/buildJars/index.d.ts +1 -0
- package/bin/keycloakify/buildJars/index.js +18 -0
- package/bin/keycloakify/buildJars/index.js.map +1 -0
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.d.ts +0 -8
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js +1 -3
- package/bin/keycloakify/buildOptions/UserProvidedBuildOptions.js.map +1 -1
- package/bin/keycloakify/buildOptions/buildOptions.d.ts +0 -2
- package/bin/keycloakify/buildOptions/buildOptions.js +3 -5
- package/bin/keycloakify/buildOptions/buildOptions.js.map +1 -1
- package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +103 -232
- package/bin/keycloakify/generateFtl/generateFtl.js +17 -39
- package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
- package/bin/keycloakify/generateFtl/pageId.d.ts +1 -1
- package/bin/keycloakify/generateFtl/pageId.js +11 -3
- package/bin/keycloakify/generateFtl/pageId.js.map +1 -1
- package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +0 -1
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js +3 -6
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
- package/bin/keycloakify/generateTheme/bringInAccountV1.d.ts +1 -1
- package/bin/keycloakify/generateTheme/bringInAccountV1.js +5 -9
- package/bin/keycloakify/generateTheme/bringInAccountV1.js.map +1 -1
- package/bin/keycloakify/generateTheme/generateSrcMainResources.d.ts +21 -0
- package/bin/keycloakify/generateTheme/generateSrcMainResources.js +340 -0
- package/bin/keycloakify/generateTheme/generateSrcMainResources.js.map +1 -0
- package/bin/keycloakify/generateTheme/generateTheme.d.ts +5 -13
- package/bin/keycloakify/generateTheme/generateTheme.js +30 -293
- package/bin/keycloakify/generateTheme/generateTheme.js.map +1 -1
- package/bin/keycloakify/generateTheme/generateThemeVariants.d.ts +5 -0
- package/bin/keycloakify/generateTheme/generateThemeVariants.js +67 -0
- package/bin/keycloakify/generateTheme/generateThemeVariants.js.map +1 -0
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js +54 -18
- package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +1 -1
- package/bin/keycloakify/keycloakify.js +28 -104
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/lib/useGetClassName.js +2 -2
- package/lib/useGetClassName.js.map +1 -1
- package/login/Fallback.d.ts +7 -1
- package/login/Fallback.js +32 -8
- package/login/Fallback.js.map +1 -1
- package/login/Template.js +76 -20
- package/login/Template.js.map +1 -1
- package/login/TemplateProps.d.ts +4 -2
- package/login/UserProfileFormFields.d.ts +22 -0
- package/login/UserProfileFormFields.js +327 -0
- package/login/UserProfileFormFields.js.map +1 -0
- package/login/i18n/baseMessages/ar.d.ts +3 -0
- package/login/i18n/baseMessages/ar.js +3 -0
- package/login/i18n/baseMessages/ar.js.map +1 -1
- package/login/i18n/baseMessages/ca.d.ts +1 -0
- package/login/i18n/baseMessages/ca.js +1 -0
- package/login/i18n/baseMessages/ca.js.map +1 -1
- package/login/i18n/baseMessages/cs.d.ts +3 -0
- package/login/i18n/baseMessages/cs.js +3 -0
- package/login/i18n/baseMessages/cs.js.map +1 -1
- package/login/i18n/baseMessages/da.d.ts +1 -0
- package/login/i18n/baseMessages/da.js +1 -0
- package/login/i18n/baseMessages/da.js.map +1 -1
- package/login/i18n/baseMessages/de.d.ts +1 -0
- package/login/i18n/baseMessages/de.js +1 -0
- package/login/i18n/baseMessages/de.js.map +1 -1
- package/login/i18n/baseMessages/el.d.ts +1 -0
- package/login/i18n/baseMessages/el.js +1 -0
- package/login/i18n/baseMessages/el.js.map +1 -1
- package/login/i18n/baseMessages/en.d.ts +7 -0
- package/login/i18n/baseMessages/en.js +23 -16
- package/login/i18n/baseMessages/en.js.map +1 -1
- package/login/i18n/baseMessages/es.d.ts +239 -0
- package/login/i18n/baseMessages/es.js +240 -1
- package/login/i18n/baseMessages/es.js.map +1 -1
- package/login/i18n/baseMessages/fa.d.ts +1 -0
- package/login/i18n/baseMessages/fa.js +1 -0
- package/login/i18n/baseMessages/fa.js.map +1 -1
- package/login/i18n/baseMessages/fi.d.ts +1 -0
- package/login/i18n/baseMessages/fi.js +1 -0
- package/login/i18n/baseMessages/fi.js.map +1 -1
- package/login/i18n/baseMessages/fr.d.ts +1 -0
- package/login/i18n/baseMessages/fr.js +2 -1
- package/login/i18n/baseMessages/fr.js.map +1 -1
- package/login/i18n/baseMessages/hu.d.ts +1 -0
- package/login/i18n/baseMessages/hu.js +1 -0
- package/login/i18n/baseMessages/hu.js.map +1 -1
- package/login/i18n/baseMessages/index.d.ts +211 -416
- package/login/i18n/baseMessages/index.js +1 -0
- package/login/i18n/baseMessages/index.js.map +1 -1
- package/login/i18n/baseMessages/it.d.ts +1 -0
- package/login/i18n/baseMessages/it.js +1 -0
- package/login/i18n/baseMessages/it.js.map +1 -1
- package/login/i18n/baseMessages/ja.d.ts +1 -0
- package/login/i18n/baseMessages/ja.js +1 -0
- package/login/i18n/baseMessages/ja.js.map +1 -1
- package/login/i18n/baseMessages/lt.d.ts +1 -0
- package/login/i18n/baseMessages/lt.js +1 -0
- package/login/i18n/baseMessages/lt.js.map +1 -1
- package/login/i18n/baseMessages/lv.d.ts +1 -0
- package/login/i18n/baseMessages/lv.js +1 -0
- package/login/i18n/baseMessages/lv.js.map +1 -1
- package/login/i18n/baseMessages/nl.d.ts +1 -0
- package/login/i18n/baseMessages/nl.js +1 -0
- package/login/i18n/baseMessages/nl.js.map +1 -1
- package/login/i18n/baseMessages/no.d.ts +1 -0
- package/login/i18n/baseMessages/no.js +1 -0
- package/login/i18n/baseMessages/no.js.map +1 -1
- package/login/i18n/baseMessages/pl.d.ts +1 -0
- package/login/i18n/baseMessages/pl.js +1 -0
- package/login/i18n/baseMessages/pl.js.map +1 -1
- package/login/i18n/baseMessages/pt-BR.d.ts +1 -0
- package/login/i18n/baseMessages/pt-BR.js +1 -0
- package/login/i18n/baseMessages/pt-BR.js.map +1 -1
- package/login/i18n/baseMessages/ru.d.ts +1 -0
- package/login/i18n/baseMessages/ru.js +1 -0
- package/login/i18n/baseMessages/ru.js.map +1 -1
- package/login/i18n/baseMessages/sk.d.ts +2 -0
- package/login/i18n/baseMessages/sk.js +3 -1
- package/login/i18n/baseMessages/sk.js.map +1 -1
- package/login/i18n/baseMessages/sv.d.ts +1 -0
- package/login/i18n/baseMessages/sv.js +1 -0
- package/login/i18n/baseMessages/sv.js.map +1 -1
- package/login/i18n/baseMessages/th.d.ts +1 -0
- package/login/i18n/baseMessages/th.js +1 -0
- package/login/i18n/baseMessages/th.js.map +1 -1
- package/login/i18n/baseMessages/tr.d.ts +1 -0
- package/login/i18n/baseMessages/tr.js +1 -0
- package/login/i18n/baseMessages/tr.js.map +1 -1
- package/login/i18n/baseMessages/uk.d.ts +433 -0
- package/login/i18n/baseMessages/uk.js +438 -0
- package/login/i18n/baseMessages/uk.js.map +1 -0
- package/login/i18n/baseMessages/zh-CN.d.ts +273 -3
- package/login/i18n/baseMessages/zh-CN.js +325 -55
- package/login/i18n/baseMessages/zh-CN.js.map +1 -1
- package/login/i18n/i18n.d.ts +4 -0
- package/login/i18n/i18n.js +6 -2
- package/login/i18n/i18n.js.map +1 -1
- package/login/kcContext/KcContext.d.ts +181 -105
- package/login/kcContext/KcContext.js +1 -1
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.js +3 -9
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/kcContextMocks.d.ts +1 -1
- package/login/kcContext/kcContextMocks.js +92 -198
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/lib/useDownloadTerms.d.ts +4 -1
- package/login/lib/useDownloadTerms.js +9 -4
- package/login/lib/useDownloadTerms.js.map +1 -1
- package/login/lib/useGetClassName.js +112 -73
- package/login/lib/useGetClassName.js.map +1 -1
- package/login/lib/useUserProfileForm.d.ts +74 -0
- package/login/lib/useUserProfileForm.js +868 -0
- package/login/lib/useUserProfileForm.js.map +1 -0
- package/login/pages/{UpdateUserProfile.d.ts → Code.d.ts} +2 -2
- package/login/pages/Code.js +13 -0
- package/login/pages/Code.js.map +1 -0
- package/login/pages/DeleteAccountConfirm.d.ts +7 -0
- package/login/pages/DeleteAccountConfirm.js +14 -0
- package/login/pages/DeleteAccountConfirm.js.map +1 -0
- package/login/pages/{RegisterUserProfile.d.ts → DeleteCredential.d.ts} +2 -2
- package/login/pages/DeleteCredential.js +14 -0
- package/login/pages/DeleteCredential.js.map +1 -0
- package/login/pages/Error.js +2 -2
- package/login/pages/Error.js.map +1 -1
- package/login/pages/FrontchannelLogout.d.ts +7 -0
- package/login/pages/FrontchannelLogout.js +14 -0
- package/login/pages/FrontchannelLogout.js.map +1 -0
- package/login/pages/IdpReviewUserProfile.d.ts +8 -2
- package/login/pages/IdpReviewUserProfile.js +3 -4
- package/login/pages/IdpReviewUserProfile.js.map +1 -1
- package/login/pages/Info.js +14 -1
- package/login/pages/Info.js.map +1 -1
- package/login/pages/Login.js +24 -38
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginConfigTotp.js +8 -1
- package/login/pages/LoginConfigTotp.js.map +1 -1
- package/login/pages/{LoginDeviceVerifyUserCode.d.ts → LoginOauth2DeviceVerifyUserCode.d.ts} +1 -1
- package/login/pages/{LoginDeviceVerifyUserCode.js → LoginOauth2DeviceVerifyUserCode.js} +2 -2
- package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -0
- package/login/pages/LoginOauthGrant.js +3 -2
- package/login/pages/LoginOauthGrant.js.map +1 -1
- package/login/pages/LoginOtp.js +4 -6
- package/login/pages/LoginOtp.js.map +1 -1
- package/login/pages/LoginPageExpired.js +1 -1
- package/login/pages/LoginPageExpired.js.map +1 -1
- package/login/pages/LoginPassword.d.ts +1 -1
- package/login/pages/LoginPassword.js +18 -11
- package/login/pages/LoginPassword.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.d.ts +7 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +147 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -0
- package/login/pages/LoginRecoveryAuthnCodeInput.d.ts +7 -0
- package/login/pages/LoginRecoveryAuthnCodeInput.js +14 -0
- package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -0
- package/login/pages/LoginResetOtp.d.ts +7 -0
- package/login/pages/LoginResetOtp.js +15 -0
- package/login/pages/LoginResetOtp.js.map +1 -0
- package/login/pages/LoginResetPassword.js +4 -3
- package/login/pages/LoginResetPassword.js.map +1 -1
- package/login/pages/LoginUpdatePassword.js +21 -3
- package/login/pages/LoginUpdatePassword.js.map +1 -1
- package/login/pages/LoginUpdateProfile.d.ts +8 -2
- package/login/pages/LoginUpdateProfile.js +11 -5
- package/login/pages/LoginUpdateProfile.js.map +1 -1
- package/login/pages/LoginUsername.js +11 -35
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/LoginVerifyEmail.js +1 -1
- package/login/pages/LoginVerifyEmail.js.map +1 -1
- package/login/pages/LoginX509Info.d.ts +7 -0
- package/login/pages/LoginX509Info.js +14 -0
- package/login/pages/LoginX509Info.js.map +1 -0
- package/login/pages/LogoutConfirm.js +1 -1
- package/login/pages/LogoutConfirm.js.map +1 -1
- package/login/pages/Register.d.ts +8 -2
- package/login/pages/Register.js +26 -4
- package/login/pages/Register.js.map +1 -1
- package/login/pages/SamlPostForm.js +1 -1
- package/login/pages/SamlPostForm.js.map +1 -1
- package/login/pages/SelectAuthenticator.js +5 -21
- package/login/pages/SelectAuthenticator.js.map +1 -1
- package/login/pages/Terms.js +4 -6
- package/login/pages/Terms.js.map +1 -1
- package/login/pages/UpdateEmail.d.ts +8 -2
- package/login/pages/UpdateEmail.js +16 -5
- package/login/pages/UpdateEmail.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +121 -83
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnError.d.ts +7 -0
- package/login/pages/WebauthnError.js +21 -0
- package/login/pages/WebauthnError.js.map +1 -0
- package/login/pages/WebauthnRegister.d.ts +7 -0
- package/login/pages/WebauthnRegister.js +193 -0
- package/login/pages/WebauthnRegister.js.map +1 -0
- package/package.json +138 -43
- package/src/account/Template.tsx +41 -14
- package/src/account/i18n/baseMessages/de.ts +1 -1
- package/src/account/i18n/baseMessages/en.ts +2 -0
- package/src/account/i18n/baseMessages/es.ts +231 -1
- package/src/account/i18n/baseMessages/index.ts +1 -0
- package/src/account/i18n/baseMessages/pl.ts +115 -1
- package/src/account/i18n/baseMessages/tr.ts +1 -1
- package/src/account/i18n/baseMessages/uk.ts +343 -0
- package/src/account/i18n/baseMessages/zh-CN.ts +10 -0
- package/src/bin/constants.ts +0 -1
- package/src/bin/keycloakify/buildJars/buildJar.ts +163 -0
- package/src/bin/keycloakify/buildJars/buildJars.ts +62 -0
- package/src/bin/keycloakify/buildJars/extensionVersions.ts +16 -0
- package/src/bin/keycloakify/buildJars/generatePom.ts +86 -0
- package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +37 -0
- package/src/bin/keycloakify/buildJars/index.ts +1 -0
- package/src/bin/keycloakify/buildOptions/UserProvidedBuildOptions.ts +1 -5
- package/src/bin/keycloakify/buildOptions/buildOptions.ts +1 -5
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +103 -232
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +15 -31
- package/src/bin/keycloakify/generateFtl/pageId.ts +11 -3
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +4 -8
- package/src/bin/keycloakify/generateTheme/bringInAccountV1.ts +5 -11
- package/src/bin/keycloakify/generateTheme/generateSrcMainResources.ts +267 -0
- package/src/bin/keycloakify/generateTheme/generateTheme.ts +22 -309
- package/src/bin/keycloakify/generateTheme/generateThemeVariants.ts +50 -0
- package/src/bin/keycloakify/generateTheme/readFieldNameUsage.ts +33 -8
- package/src/bin/keycloakify/keycloakify.ts +23 -56
- package/src/lib/useGetClassName.ts +2 -2
- package/src/login/Fallback.tsx +39 -9
- package/src/login/Template.tsx +160 -61
- package/src/login/TemplateProps.ts +113 -63
- package/src/login/UserProfileFormFields.tsx +750 -0
- package/src/login/i18n/baseMessages/ar.ts +3 -0
- package/src/login/i18n/baseMessages/ca.ts +1 -0
- package/src/login/i18n/baseMessages/cs.ts +3 -0
- package/src/login/i18n/baseMessages/da.ts +1 -0
- package/src/login/i18n/baseMessages/de.ts +1 -0
- package/src/login/i18n/baseMessages/el.ts +1 -0
- package/src/login/i18n/baseMessages/en.ts +23 -16
- package/src/login/i18n/baseMessages/es.ts +240 -1
- package/src/login/i18n/baseMessages/fa.ts +1 -0
- package/src/login/i18n/baseMessages/fi.ts +1 -0
- package/src/login/i18n/baseMessages/fr.ts +2 -1
- package/src/login/i18n/baseMessages/hu.ts +1 -0
- package/src/login/i18n/baseMessages/index.ts +1 -0
- package/src/login/i18n/baseMessages/it.ts +1 -0
- package/src/login/i18n/baseMessages/ja.ts +1 -0
- package/src/login/i18n/baseMessages/lt.ts +1 -0
- package/src/login/i18n/baseMessages/lv.ts +1 -0
- package/src/login/i18n/baseMessages/nl.ts +1 -0
- package/src/login/i18n/baseMessages/no.ts +1 -0
- package/src/login/i18n/baseMessages/pl.ts +1 -0
- package/src/login/i18n/baseMessages/pt-BR.ts +1 -0
- package/src/login/i18n/baseMessages/ru.ts +1 -0
- package/src/login/i18n/baseMessages/sk.ts +3 -1
- package/src/login/i18n/baseMessages/sv.ts +1 -0
- package/src/login/i18n/baseMessages/th.ts +1 -0
- package/src/login/i18n/baseMessages/tr.ts +1 -0
- package/src/login/i18n/baseMessages/uk.ts +439 -0
- package/src/login/i18n/baseMessages/zh-CN.ts +325 -55
- package/src/login/i18n/i18n.tsx +6 -2
- package/src/login/kcContext/KcContext.ts +216 -103
- package/src/login/kcContext/createGetKcContext.ts +11 -19
- package/src/login/kcContext/kcContextMocks.ts +165 -226
- package/src/login/lib/useDownloadTerms.ts +15 -7
- package/src/login/lib/useGetClassName.ts +112 -83
- package/src/login/lib/useUserProfileForm.tsx +1227 -0
- package/src/login/pages/Code.tsx +35 -0
- package/src/login/pages/DeleteAccountConfirm.tsx +53 -0
- package/src/login/pages/DeleteCredential.tsx +45 -0
- package/src/login/pages/Error.tsx +2 -2
- package/src/login/pages/FrontchannelLogout.tsx +41 -0
- package/src/login/pages/IdpReviewUserProfile.tsx +15 -5
- package/src/login/pages/Info.tsx +29 -19
- package/src/login/pages/Login.tsx +156 -117
- package/src/login/pages/LoginConfigTotp.tsx +26 -1
- package/src/login/pages/{LoginDeviceVerifyUserCode.tsx → LoginOauth2DeviceVerifyUserCode.tsx} +3 -1
- package/src/login/pages/LoginOauthGrant.tsx +38 -2
- package/src/login/pages/LoginOtp.tsx +73 -65
- package/src/login/pages/LoginPageExpired.tsx +1 -1
- package/src/login/pages/LoginPassword.tsx +77 -28
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +260 -0
- package/src/login/pages/LoginRecoveryAuthnCodeInput.tsx +73 -0
- package/src/login/pages/LoginResetOtp.tsx +70 -0
- package/src/login/pages/LoginResetPassword.tsx +11 -4
- package/src/login/pages/LoginUpdatePassword.tsx +120 -81
- package/src/login/pages/LoginUpdateProfile.tsx +41 -115
- package/src/login/pages/LoginUsername.tsx +93 -101
- package/src/login/pages/LoginVerifyEmail.tsx +14 -8
- package/src/login/pages/LoginX509Info.tsx +94 -0
- package/src/login/pages/LogoutConfirm.tsx +2 -2
- package/src/login/pages/Register.tsx +83 -131
- package/src/login/pages/SamlPostForm.tsx +1 -1
- package/src/login/pages/SelectAuthenticator.tsx +29 -52
- package/src/login/pages/Terms.tsx +4 -7
- package/src/login/pages/UpdateEmail.tsx +69 -54
- package/src/login/pages/WebauthnAuthenticate.tsx +205 -165
- package/src/login/pages/WebauthnError.tsx +66 -0
- package/src/login/pages/WebauthnRegister.tsx +285 -0
- package/src/tools/formatNumber.ts +48 -0
- package/src/tools/useInsertLinkTags.ts +82 -0
- package/src/tools/useInsertScriptTags.ts +106 -0
- package/src/tools/useSetClassName.ts +21 -0
- package/tools/formatNumber.d.ts +1 -0
- package/tools/formatNumber.js +37 -0
- package/tools/formatNumber.js.map +1 -0
- package/tools/useInsertLinkTags.d.ts +7 -0
- package/tools/useInsertLinkTags.js +57 -0
- package/tools/useInsertLinkTags.js.map +1 -0
- package/tools/useInsertScriptTags.d.ts +20 -0
- package/tools/useInsertScriptTags.js +75 -0
- package/tools/useInsertScriptTags.js.map +1 -0
- package/tools/useSetClassName.d.ts +4 -0
- package/tools/useSetClassName.js +16 -0
- package/tools/useSetClassName.js.map +1 -0
- package/vite-plugin/tsconfig.tsbuildinfo +1 -1
- package/bin/keycloakify/generatePom.d.ts +0 -12
- package/bin/keycloakify/generatePom.js +0 -59
- package/bin/keycloakify/generatePom.js.map +0 -1
- package/lib/usePrepareTemplate.d.ts +0 -11
- package/lib/usePrepareTemplate.js +0 -80
- package/lib/usePrepareTemplate.js.map +0 -1
- package/login/lib/useFormValidation.d.ts +0 -47
- package/login/lib/useFormValidation.js +0 -316
- package/login/lib/useFormValidation.js.map +0 -1
- package/login/pages/LoginDeviceVerifyUserCode.js.map +0 -1
- package/login/pages/RegisterUserProfile.js +0 -18
- package/login/pages/RegisterUserProfile.js.map +0 -1
- package/login/pages/UpdateUserProfile.js +0 -17
- package/login/pages/UpdateUserProfile.js.map +0 -1
- package/login/pages/shared/UserProfileFormFields.d.ts +0 -18
- package/login/pages/shared/UserProfileFormFields.js +0 -58
- package/login/pages/shared/UserProfileFormFields.js.map +0 -1
- package/src/bin/keycloakify/generatePom.ts +0 -70
- package/src/lib/usePrepareTemplate.ts +0 -113
- package/src/login/lib/useFormValidation.tsx +0 -474
- package/src/login/pages/RegisterUserProfile.tsx +0 -72
- package/src/login/pages/UpdateUserProfile.tsx +0 -82
- package/src/login/pages/shared/UserProfileFormFields.tsx +0 -177
- package/src/tools/headInsert.ts +0 -73
- package/tools/headInsert.d.ts +0 -12
- package/tools/headInsert.js +0 -50
- package/tools/headInsert.js.map +0 -1
@@ -0,0 +1,868 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import "../../tools/Array.prototype.every";
|
14
|
+
import { useMemo, useReducer, useEffect, Fragment } from "react";
|
15
|
+
import { id } from "tsafe/id";
|
16
|
+
import { useConstCallback } from "../../tools/useConstCallback";
|
17
|
+
import { emailRegexp } from "../../tools/emailRegExp";
|
18
|
+
import { assert } from "tsafe/assert";
|
19
|
+
import { formatNumber } from "../../tools/formatNumber";
|
20
|
+
import { createUseInsertScriptTags } from "../../tools/useInsertScriptTags";
|
21
|
+
const { useInsertScriptTags } = createUseInsertScriptTags();
|
22
|
+
export function useUserProfileForm(params) {
|
23
|
+
var _a, _b;
|
24
|
+
const { kcContext, i18n, doMakeUserConfirmPassword } = params;
|
25
|
+
const { insertScriptTags } = useInsertScriptTags({
|
26
|
+
"scriptTags": Object.keys((_b = (_a = kcContext.profile) === null || _a === void 0 ? void 0 : _a.html5DataAnnotations) !== null && _b !== void 0 ? _b : {})
|
27
|
+
.filter(key => key !== "kcMultivalued" && key !== "kcNumberFormat") // NOTE: Keycloakify handles it.
|
28
|
+
.map(key => ({
|
29
|
+
"type": "module",
|
30
|
+
"src": `${kcContext.url.resourcesPath}/js/${key}.js`
|
31
|
+
}))
|
32
|
+
});
|
33
|
+
useEffect(() => {
|
34
|
+
insertScriptTags();
|
35
|
+
}, []);
|
36
|
+
const { getErrors } = useGetErrors({
|
37
|
+
kcContext,
|
38
|
+
i18n
|
39
|
+
});
|
40
|
+
const initialState = useMemo(() => {
|
41
|
+
// NOTE: We don't use te kcContext.profile.attributes directly because
|
42
|
+
// they don't includes the password and password confirm fields and we want to add them.
|
43
|
+
// Also, we want to polyfill the attributes for older Keycloak version before User Profile was introduced.
|
44
|
+
// Finally we want to patch the changes made by Keycloak on the attributes format so we have an homogeneous
|
45
|
+
// attributes format to work with.
|
46
|
+
const syntheticAttributes = (() => {
|
47
|
+
const syntheticAttributes = [];
|
48
|
+
const attributes = (() => {
|
49
|
+
var _a;
|
50
|
+
retrocompat_patch: {
|
51
|
+
if ("profile" in kcContext && "attributes" in kcContext.profile && kcContext.profile.attributes.length !== 0) {
|
52
|
+
break retrocompat_patch;
|
53
|
+
}
|
54
|
+
if ("register" in kcContext && kcContext.register instanceof Object && "formData" in kcContext.register) {
|
55
|
+
//NOTE: Handle legacy register.ftl page
|
56
|
+
return ["firstName", "lastName", "email", "username"]
|
57
|
+
.filter(name => (name !== "username" ? true : !kcContext.realm.registrationEmailAsUsername))
|
58
|
+
.map(name => {
|
59
|
+
var _a;
|
60
|
+
return id({
|
61
|
+
"name": name,
|
62
|
+
"displayName": id(`\${${name}}`),
|
63
|
+
"required": true,
|
64
|
+
"value": (_a = kcContext.register.formData[name]) !== null && _a !== void 0 ? _a : "",
|
65
|
+
"html5DataAnnotations": {},
|
66
|
+
"readOnly": false,
|
67
|
+
"validators": {},
|
68
|
+
"annotations": {},
|
69
|
+
"autocomplete": (() => {
|
70
|
+
switch (name) {
|
71
|
+
case "email":
|
72
|
+
return "email";
|
73
|
+
case "username":
|
74
|
+
return "username";
|
75
|
+
default:
|
76
|
+
return undefined;
|
77
|
+
}
|
78
|
+
})()
|
79
|
+
});
|
80
|
+
});
|
81
|
+
}
|
82
|
+
if ("user" in kcContext && kcContext.user instanceof Object) {
|
83
|
+
//NOTE: Handle legacy login-update-profile.ftl
|
84
|
+
return ["username", "email", "firstName", "lastName"]
|
85
|
+
.filter(name => (name !== "username" ? true : kcContext.user.editUsernameAllowed))
|
86
|
+
.map(name => {
|
87
|
+
var _a;
|
88
|
+
return id({
|
89
|
+
"name": name,
|
90
|
+
"displayName": id(`\${${name}}`),
|
91
|
+
"required": true,
|
92
|
+
"value": (_a = kcContext.user[name]) !== null && _a !== void 0 ? _a : "",
|
93
|
+
"html5DataAnnotations": {},
|
94
|
+
"readOnly": false,
|
95
|
+
"validators": {},
|
96
|
+
"annotations": {},
|
97
|
+
"autocomplete": (() => {
|
98
|
+
switch (name) {
|
99
|
+
case "email":
|
100
|
+
return "email";
|
101
|
+
case "username":
|
102
|
+
return "username";
|
103
|
+
default:
|
104
|
+
return undefined;
|
105
|
+
}
|
106
|
+
})()
|
107
|
+
});
|
108
|
+
});
|
109
|
+
}
|
110
|
+
if ("email" in kcContext && kcContext.email instanceof Object) {
|
111
|
+
//NOTE: Handle legacy update-email.ftl
|
112
|
+
return [
|
113
|
+
id({
|
114
|
+
"name": "email",
|
115
|
+
"displayName": id(`\${email}`),
|
116
|
+
"required": true,
|
117
|
+
"value": (_a = kcContext.email.value) !== null && _a !== void 0 ? _a : "",
|
118
|
+
"html5DataAnnotations": {},
|
119
|
+
"readOnly": false,
|
120
|
+
"validators": {},
|
121
|
+
"annotations": {},
|
122
|
+
"autocomplete": "email"
|
123
|
+
})
|
124
|
+
];
|
125
|
+
}
|
126
|
+
assert(false, "Unable to mock user profile from the current kcContext");
|
127
|
+
}
|
128
|
+
return kcContext.profile.attributes.map(attribute_pre_group_patch => {
|
129
|
+
if (typeof attribute_pre_group_patch.group === "string" && attribute_pre_group_patch.group !== "") {
|
130
|
+
const _a = attribute_pre_group_patch, { group, groupDisplayHeader, groupDisplayDescription, groupAnnotations } = _a, rest = __rest(_a, ["group", "groupDisplayHeader", "groupDisplayDescription", "groupAnnotations"]);
|
131
|
+
return id(Object.assign(Object.assign({}, rest), { "group": {
|
132
|
+
"name": group,
|
133
|
+
"displayHeader": groupDisplayHeader,
|
134
|
+
"displayDescription": groupDisplayDescription,
|
135
|
+
"html5DataAnnotations": {}
|
136
|
+
} }));
|
137
|
+
}
|
138
|
+
return attribute_pre_group_patch;
|
139
|
+
});
|
140
|
+
})();
|
141
|
+
for (const attribute of attributes) {
|
142
|
+
syntheticAttributes.push(attribute);
|
143
|
+
add_password_and_password_confirm: {
|
144
|
+
if (!kcContext.passwordRequired) {
|
145
|
+
break add_password_and_password_confirm;
|
146
|
+
}
|
147
|
+
if (attribute.name !== (kcContext.realm.registrationEmailAsUsername ? "email" : "username")) {
|
148
|
+
// NOTE: We want to add password and password-confirm after the field that identifies the user.
|
149
|
+
// It's either email or username.
|
150
|
+
break add_password_and_password_confirm;
|
151
|
+
}
|
152
|
+
syntheticAttributes.push(Object.assign({ "name": "password", "displayName": id("${password}"), "required": true, "readOnly": false, "validators": {}, "annotations": {}, "autocomplete": "new-password", "html5DataAnnotations": {} }, { "groupAnnotations": {} }), Object.assign({ "name": "password-confirm", "displayName": id("${passwordConfirm}"), "required": true, "readOnly": false, "validators": {}, "annotations": {}, "html5DataAnnotations": {}, "autocomplete": "new-password" }, { "groupAnnotations": {} }));
|
153
|
+
}
|
154
|
+
}
|
155
|
+
return syntheticAttributes;
|
156
|
+
})();
|
157
|
+
const initialFormFieldState = (() => {
|
158
|
+
var _a, _b, _c;
|
159
|
+
const out = [];
|
160
|
+
for (const attribute of syntheticAttributes) {
|
161
|
+
handle_multi_valued_attribute: {
|
162
|
+
if (!attribute.multivalued) {
|
163
|
+
break handle_multi_valued_attribute;
|
164
|
+
}
|
165
|
+
const values = (_a = attribute.values) !== null && _a !== void 0 ? _a : [""];
|
166
|
+
apply_validator_min_range: {
|
167
|
+
if ((_b = attribute.annotations.inputType) === null || _b === void 0 ? void 0 : _b.startsWith("multiselect")) {
|
168
|
+
break apply_validator_min_range;
|
169
|
+
}
|
170
|
+
const validator = attribute.validators.multivalued;
|
171
|
+
if (validator === undefined) {
|
172
|
+
break apply_validator_min_range;
|
173
|
+
}
|
174
|
+
const { min: minStr } = validator;
|
175
|
+
if (minStr === undefined) {
|
176
|
+
break apply_validator_min_range;
|
177
|
+
}
|
178
|
+
const min = parseInt(`${minStr}`);
|
179
|
+
for (let index = values.length; index < min; index++) {
|
180
|
+
values.push("");
|
181
|
+
}
|
182
|
+
}
|
183
|
+
out.push({
|
184
|
+
attribute,
|
185
|
+
"valueOrValues": values
|
186
|
+
});
|
187
|
+
continue;
|
188
|
+
}
|
189
|
+
out.push({
|
190
|
+
attribute,
|
191
|
+
"valueOrValues": (_c = attribute.value) !== null && _c !== void 0 ? _c : ""
|
192
|
+
});
|
193
|
+
}
|
194
|
+
return out;
|
195
|
+
})();
|
196
|
+
const initialState = {
|
197
|
+
"formFieldStates": initialFormFieldState.map(({ attribute, valueOrValues }) => ({
|
198
|
+
attribute,
|
199
|
+
"errors": getErrors({
|
200
|
+
"attributeName": attribute.name,
|
201
|
+
"formFieldStates": initialFormFieldState
|
202
|
+
}),
|
203
|
+
"hasLostFocusAtLeastOnce": valueOrValues instanceof Array ? valueOrValues.map(() => false) : false,
|
204
|
+
"valueOrValues": valueOrValues
|
205
|
+
}))
|
206
|
+
};
|
207
|
+
return initialState;
|
208
|
+
}, []);
|
209
|
+
const [state, dispatchFormAction] = useReducer(function reducer(state, params) {
|
210
|
+
const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name === params.name);
|
211
|
+
assert(formFieldState !== undefined);
|
212
|
+
(() => {
|
213
|
+
var _a;
|
214
|
+
switch (params.action) {
|
215
|
+
case "update":
|
216
|
+
formFieldState.valueOrValues = params.valueOrValues;
|
217
|
+
apply_formatters: {
|
218
|
+
const { attribute } = formFieldState;
|
219
|
+
const { kcNumberFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
220
|
+
if (kcNumberFormat === undefined) {
|
221
|
+
break apply_formatters;
|
222
|
+
}
|
223
|
+
if (formFieldState.valueOrValues instanceof Array) {
|
224
|
+
formFieldState.valueOrValues = formFieldState.valueOrValues.map(value => formatNumber(value, kcNumberFormat));
|
225
|
+
}
|
226
|
+
else {
|
227
|
+
formFieldState.valueOrValues = formatNumber(formFieldState.valueOrValues, kcNumberFormat);
|
228
|
+
}
|
229
|
+
}
|
230
|
+
formFieldState.errors = getErrors({
|
231
|
+
"attributeName": params.name,
|
232
|
+
"formFieldStates": state.formFieldStates
|
233
|
+
});
|
234
|
+
update_password_confirm: {
|
235
|
+
if (doMakeUserConfirmPassword) {
|
236
|
+
break update_password_confirm;
|
237
|
+
}
|
238
|
+
if (params.name !== "password") {
|
239
|
+
break update_password_confirm;
|
240
|
+
}
|
241
|
+
state = reducer(state, {
|
242
|
+
"action": "update",
|
243
|
+
"name": "password-confirm",
|
244
|
+
"valueOrValues": params.valueOrValues
|
245
|
+
});
|
246
|
+
}
|
247
|
+
return;
|
248
|
+
case "focus lost":
|
249
|
+
if (formFieldState.hasLostFocusAtLeastOnce instanceof Array) {
|
250
|
+
const { fieldIndex } = params;
|
251
|
+
assert(fieldIndex !== undefined);
|
252
|
+
formFieldState.hasLostFocusAtLeastOnce[fieldIndex] = true;
|
253
|
+
return;
|
254
|
+
}
|
255
|
+
formFieldState.hasLostFocusAtLeastOnce = true;
|
256
|
+
return;
|
257
|
+
}
|
258
|
+
assert(false);
|
259
|
+
})();
|
260
|
+
return state;
|
261
|
+
}, initialState);
|
262
|
+
const formState = useMemo(() => ({
|
263
|
+
"formFieldStates": state.formFieldStates.map((_a) => {
|
264
|
+
var { errors, hasLostFocusAtLeastOnce: hasLostFocusAtLeastOnceOrArr, attribute } = _a, valueOrValuesWrap = __rest(_a, ["errors", "hasLostFocusAtLeastOnce", "attribute"]);
|
265
|
+
return (Object.assign({ "displayableErrors": errors.filter(error => {
|
266
|
+
const hasLostFocusAtLeastOnce = typeof hasLostFocusAtLeastOnceOrArr === "boolean"
|
267
|
+
? hasLostFocusAtLeastOnceOrArr
|
268
|
+
: error.fieldIndex !== undefined
|
269
|
+
? hasLostFocusAtLeastOnceOrArr[error.fieldIndex]
|
270
|
+
: hasLostFocusAtLeastOnceOrArr[hasLostFocusAtLeastOnceOrArr.length - 1];
|
271
|
+
switch (error.source.type) {
|
272
|
+
case "server":
|
273
|
+
return true;
|
274
|
+
case "other":
|
275
|
+
switch (error.source.rule) {
|
276
|
+
case "requiredField":
|
277
|
+
return hasLostFocusAtLeastOnce;
|
278
|
+
case "passwordConfirmMatchesPassword":
|
279
|
+
return hasLostFocusAtLeastOnce;
|
280
|
+
}
|
281
|
+
assert(false);
|
282
|
+
case "passwordPolicy":
|
283
|
+
switch (error.source.name) {
|
284
|
+
case "length":
|
285
|
+
return hasLostFocusAtLeastOnce;
|
286
|
+
case "digits":
|
287
|
+
return hasLostFocusAtLeastOnce;
|
288
|
+
case "lowerCase":
|
289
|
+
return hasLostFocusAtLeastOnce;
|
290
|
+
case "upperCase":
|
291
|
+
return hasLostFocusAtLeastOnce;
|
292
|
+
case "specialChars":
|
293
|
+
return hasLostFocusAtLeastOnce;
|
294
|
+
case "notUsername":
|
295
|
+
return true;
|
296
|
+
case "notEmail":
|
297
|
+
return true;
|
298
|
+
}
|
299
|
+
assert(false);
|
300
|
+
case "validator":
|
301
|
+
switch (error.source.name) {
|
302
|
+
case "length":
|
303
|
+
return hasLostFocusAtLeastOnce;
|
304
|
+
case "pattern":
|
305
|
+
return hasLostFocusAtLeastOnce;
|
306
|
+
case "email":
|
307
|
+
return hasLostFocusAtLeastOnce;
|
308
|
+
case "integer":
|
309
|
+
return hasLostFocusAtLeastOnce;
|
310
|
+
case "multivalued":
|
311
|
+
return hasLostFocusAtLeastOnce;
|
312
|
+
case "options":
|
313
|
+
return hasLostFocusAtLeastOnce;
|
314
|
+
}
|
315
|
+
assert(false);
|
316
|
+
}
|
317
|
+
}), attribute }, valueOrValuesWrap));
|
318
|
+
}),
|
319
|
+
"isFormSubmittable": state.formFieldStates.every(({ errors }) => errors.length === 0)
|
320
|
+
}), [state]);
|
321
|
+
return {
|
322
|
+
formState,
|
323
|
+
dispatchFormAction
|
324
|
+
};
|
325
|
+
}
|
326
|
+
function useGetErrors(params) {
|
327
|
+
const { kcContext, i18n } = params;
|
328
|
+
const { messagesPerField, passwordPolicies } = kcContext;
|
329
|
+
const { msg, msgStr, advancedMsg, advancedMsgStr } = i18n;
|
330
|
+
const getErrors = useConstCallback((params) => {
|
331
|
+
var _a, _b, _c, _d;
|
332
|
+
const { attributeName, formFieldStates } = params;
|
333
|
+
const formFieldState = formFieldStates.find(({ attribute }) => attribute.name === attributeName);
|
334
|
+
assert(formFieldState !== undefined);
|
335
|
+
const { attribute } = formFieldState;
|
336
|
+
const valueOrValues = (() => {
|
337
|
+
var _a;
|
338
|
+
let { valueOrValues } = formFieldState;
|
339
|
+
unFormat_number: {
|
340
|
+
const { kcNumberUnFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
341
|
+
if (kcNumberUnFormat === undefined) {
|
342
|
+
break unFormat_number;
|
343
|
+
}
|
344
|
+
if (valueOrValues instanceof Array) {
|
345
|
+
valueOrValues = valueOrValues.map(value => formatNumber(value, kcNumberUnFormat));
|
346
|
+
}
|
347
|
+
else {
|
348
|
+
valueOrValues = formatNumber(valueOrValues, kcNumberUnFormat);
|
349
|
+
}
|
350
|
+
}
|
351
|
+
return valueOrValues;
|
352
|
+
})();
|
353
|
+
assert(attribute !== undefined);
|
354
|
+
server_side_error: {
|
355
|
+
if (attribute.multivalued) {
|
356
|
+
const defaultValues = (_a = attribute.values) !== null && _a !== void 0 ? _a : [""];
|
357
|
+
assert(valueOrValues instanceof Array);
|
358
|
+
const values = valueOrValues;
|
359
|
+
if (JSON.stringify(defaultValues) !== JSON.stringify(values.slice(0, defaultValues.length))) {
|
360
|
+
break server_side_error;
|
361
|
+
}
|
362
|
+
}
|
363
|
+
else {
|
364
|
+
const defaultValue = (_b = attribute.value) !== null && _b !== void 0 ? _b : "";
|
365
|
+
assert(typeof valueOrValues === "string");
|
366
|
+
const value = valueOrValues;
|
367
|
+
if (defaultValue !== value) {
|
368
|
+
break server_side_error;
|
369
|
+
}
|
370
|
+
}
|
371
|
+
let doesErrorExist;
|
372
|
+
try {
|
373
|
+
doesErrorExist = messagesPerField.existsError(attributeName);
|
374
|
+
}
|
375
|
+
catch (_e) {
|
376
|
+
break server_side_error;
|
377
|
+
}
|
378
|
+
if (!doesErrorExist) {
|
379
|
+
break server_side_error;
|
380
|
+
}
|
381
|
+
const errorMessageStr = messagesPerField.get(attributeName);
|
382
|
+
return [
|
383
|
+
{
|
384
|
+
errorMessageStr,
|
385
|
+
"errorMessage": _jsx("span", { children: errorMessageStr }, 0),
|
386
|
+
"fieldIndex": undefined,
|
387
|
+
"source": {
|
388
|
+
"type": "server"
|
389
|
+
}
|
390
|
+
}
|
391
|
+
];
|
392
|
+
}
|
393
|
+
handle_multi_valued_multi_fields: {
|
394
|
+
if (!attribute.multivalued) {
|
395
|
+
break handle_multi_valued_multi_fields;
|
396
|
+
}
|
397
|
+
if ((_c = attribute.annotations.inputType) === null || _c === void 0 ? void 0 : _c.startsWith("multiselect")) {
|
398
|
+
break handle_multi_valued_multi_fields;
|
399
|
+
}
|
400
|
+
assert(valueOrValues instanceof Array);
|
401
|
+
const values = valueOrValues;
|
402
|
+
const errors = values
|
403
|
+
.map((...[, index]) => {
|
404
|
+
const specificValueErrors = getErrors({
|
405
|
+
attributeName,
|
406
|
+
"formFieldStates": formFieldStates.map(formFieldState => {
|
407
|
+
if (formFieldState.attribute.name === attributeName) {
|
408
|
+
assert(formFieldState.valueOrValues instanceof Array);
|
409
|
+
return {
|
410
|
+
"attribute": Object.assign(Object.assign({}, attribute), { "annotations": Object.assign(Object.assign({}, attribute.annotations), { "inputType": undefined }), "multivalued": false }),
|
411
|
+
"valueOrValues": formFieldState.valueOrValues[index]
|
412
|
+
};
|
413
|
+
}
|
414
|
+
return formFieldState;
|
415
|
+
})
|
416
|
+
});
|
417
|
+
return specificValueErrors
|
418
|
+
.filter(error => {
|
419
|
+
if (error.source.type === "other" && error.source.rule === "requiredField") {
|
420
|
+
return false;
|
421
|
+
}
|
422
|
+
return true;
|
423
|
+
})
|
424
|
+
.map((error) => (Object.assign(Object.assign({}, error), { "fieldIndex": index })));
|
425
|
+
})
|
426
|
+
.reduce((acc, errors) => [...acc, ...errors], []);
|
427
|
+
required_field: {
|
428
|
+
if (!attribute.required) {
|
429
|
+
break required_field;
|
430
|
+
}
|
431
|
+
if (values.every(value => value !== "")) {
|
432
|
+
break required_field;
|
433
|
+
}
|
434
|
+
const msgArgs = ["error-user-attribute-required"];
|
435
|
+
errors.push({
|
436
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
437
|
+
"errorMessageStr": msgStr(...msgArgs),
|
438
|
+
"fieldIndex": undefined,
|
439
|
+
"source": {
|
440
|
+
"type": "other",
|
441
|
+
"rule": "requiredField"
|
442
|
+
}
|
443
|
+
});
|
444
|
+
}
|
445
|
+
return errors;
|
446
|
+
}
|
447
|
+
handle_multi_valued_single_field: {
|
448
|
+
if (!attribute.multivalued) {
|
449
|
+
break handle_multi_valued_single_field;
|
450
|
+
}
|
451
|
+
if (!((_d = attribute.annotations.inputType) === null || _d === void 0 ? void 0 : _d.startsWith("multiselect"))) {
|
452
|
+
break handle_multi_valued_single_field;
|
453
|
+
}
|
454
|
+
const validatorName = "multivalued";
|
455
|
+
const validator = attribute.validators[validatorName];
|
456
|
+
if (validator === undefined) {
|
457
|
+
return [];
|
458
|
+
}
|
459
|
+
const { min: minStr } = validator;
|
460
|
+
const min = minStr !== undefined ? parseInt(`${minStr}`) : attribute.required ? 1 : 0;
|
461
|
+
assert(!isNaN(min));
|
462
|
+
const { max: maxStr } = validator;
|
463
|
+
const max = maxStr === undefined ? Infinity : parseInt(`${maxStr}`);
|
464
|
+
assert(!isNaN(max));
|
465
|
+
assert(valueOrValues instanceof Array);
|
466
|
+
const values = valueOrValues;
|
467
|
+
if (min <= values.length && values.length <= max) {
|
468
|
+
return [];
|
469
|
+
}
|
470
|
+
const msgArgs = ["error-invalid-multivalued-size", `${min}`, `${max}`];
|
471
|
+
return [
|
472
|
+
{
|
473
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, 0),
|
474
|
+
"errorMessageStr": msgStr(...msgArgs),
|
475
|
+
"fieldIndex": undefined,
|
476
|
+
"source": {
|
477
|
+
"type": "validator",
|
478
|
+
"name": validatorName
|
479
|
+
}
|
480
|
+
}
|
481
|
+
];
|
482
|
+
}
|
483
|
+
assert(typeof valueOrValues === "string");
|
484
|
+
const value = valueOrValues;
|
485
|
+
const errors = [];
|
486
|
+
check_password_policies: {
|
487
|
+
if (attributeName !== "password") {
|
488
|
+
break check_password_policies;
|
489
|
+
}
|
490
|
+
if (passwordPolicies === undefined) {
|
491
|
+
break check_password_policies;
|
492
|
+
}
|
493
|
+
check_password_policy_x: {
|
494
|
+
const policyName = "length";
|
495
|
+
const policy = passwordPolicies[policyName];
|
496
|
+
if (policy === undefined) {
|
497
|
+
break check_password_policy_x;
|
498
|
+
}
|
499
|
+
const minLength = policy;
|
500
|
+
if (value.length >= minLength) {
|
501
|
+
break check_password_policy_x;
|
502
|
+
}
|
503
|
+
const msgArgs = ["invalidPasswordMinLengthMessage", `${minLength}`];
|
504
|
+
errors.push({
|
505
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
506
|
+
"errorMessageStr": msgStr(...msgArgs),
|
507
|
+
"fieldIndex": undefined,
|
508
|
+
"source": {
|
509
|
+
"type": "passwordPolicy",
|
510
|
+
"name": policyName
|
511
|
+
}
|
512
|
+
});
|
513
|
+
}
|
514
|
+
check_password_policy_x: {
|
515
|
+
const policyName = "digits";
|
516
|
+
const policy = passwordPolicies[policyName];
|
517
|
+
if (policy === undefined) {
|
518
|
+
break check_password_policy_x;
|
519
|
+
}
|
520
|
+
const minNumberOfDigits = policy;
|
521
|
+
if (value.split("").filter(char => !isNaN(parseInt(char))).length >= minNumberOfDigits) {
|
522
|
+
break check_password_policy_x;
|
523
|
+
}
|
524
|
+
const msgArgs = ["invalidPasswordMinDigitsMessage", `${minNumberOfDigits}`];
|
525
|
+
errors.push({
|
526
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
527
|
+
"errorMessageStr": msgStr(...msgArgs),
|
528
|
+
"fieldIndex": undefined,
|
529
|
+
"source": {
|
530
|
+
"type": "passwordPolicy",
|
531
|
+
"name": policyName
|
532
|
+
}
|
533
|
+
});
|
534
|
+
}
|
535
|
+
check_password_policy_x: {
|
536
|
+
const policyName = "lowerCase";
|
537
|
+
const policy = passwordPolicies[policyName];
|
538
|
+
if (policy === undefined) {
|
539
|
+
break check_password_policy_x;
|
540
|
+
}
|
541
|
+
const minNumberOfLowerCaseChar = policy;
|
542
|
+
if (value.split("").filter(char => char === char.toLowerCase() && char !== char.toUpperCase()).length >= minNumberOfLowerCaseChar) {
|
543
|
+
break check_password_policy_x;
|
544
|
+
}
|
545
|
+
const msgArgs = ["invalidPasswordMinLowerCaseCharsMessage", `${minNumberOfLowerCaseChar}`];
|
546
|
+
errors.push({
|
547
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
548
|
+
"errorMessageStr": msgStr(...msgArgs),
|
549
|
+
"fieldIndex": undefined,
|
550
|
+
"source": {
|
551
|
+
"type": "passwordPolicy",
|
552
|
+
"name": policyName
|
553
|
+
}
|
554
|
+
});
|
555
|
+
}
|
556
|
+
check_password_policy_x: {
|
557
|
+
const policyName = "upperCase";
|
558
|
+
const policy = passwordPolicies[policyName];
|
559
|
+
if (policy === undefined) {
|
560
|
+
break check_password_policy_x;
|
561
|
+
}
|
562
|
+
const minNumberOfUpperCaseChar = policy;
|
563
|
+
if (value.split("").filter(char => char === char.toUpperCase() && char !== char.toLowerCase()).length >= minNumberOfUpperCaseChar) {
|
564
|
+
break check_password_policy_x;
|
565
|
+
}
|
566
|
+
const msgArgs = ["invalidPasswordMinUpperCaseCharsMessage", `${minNumberOfUpperCaseChar}`];
|
567
|
+
errors.push({
|
568
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
569
|
+
"errorMessageStr": msgStr(...msgArgs),
|
570
|
+
"fieldIndex": undefined,
|
571
|
+
"source": {
|
572
|
+
"type": "passwordPolicy",
|
573
|
+
"name": policyName
|
574
|
+
}
|
575
|
+
});
|
576
|
+
}
|
577
|
+
check_password_policy_x: {
|
578
|
+
const policyName = "specialChars";
|
579
|
+
const policy = passwordPolicies[policyName];
|
580
|
+
if (policy === undefined) {
|
581
|
+
break check_password_policy_x;
|
582
|
+
}
|
583
|
+
const minNumberOfSpecialChar = policy;
|
584
|
+
if (value.split("").filter(char => !char.match(/[a-zA-Z0-9]/)).length >= minNumberOfSpecialChar) {
|
585
|
+
break check_password_policy_x;
|
586
|
+
}
|
587
|
+
const msgArgs = ["invalidPasswordMinSpecialCharsMessage", `${minNumberOfSpecialChar}`];
|
588
|
+
errors.push({
|
589
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
590
|
+
"errorMessageStr": msgStr(...msgArgs),
|
591
|
+
"fieldIndex": undefined,
|
592
|
+
"source": {
|
593
|
+
"type": "passwordPolicy",
|
594
|
+
"name": policyName
|
595
|
+
}
|
596
|
+
});
|
597
|
+
}
|
598
|
+
check_password_policy_x: {
|
599
|
+
const policyName = "notUsername";
|
600
|
+
const notUsername = passwordPolicies[policyName];
|
601
|
+
if (!notUsername) {
|
602
|
+
break check_password_policy_x;
|
603
|
+
}
|
604
|
+
const usernameFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "username");
|
605
|
+
if (usernameFormFieldState === undefined) {
|
606
|
+
break check_password_policy_x;
|
607
|
+
}
|
608
|
+
const usernameValue = (() => {
|
609
|
+
var _a;
|
610
|
+
let { valueOrValues } = usernameFormFieldState;
|
611
|
+
assert(typeof valueOrValues === "string");
|
612
|
+
unFormat_number: {
|
613
|
+
const { kcNumberUnFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
614
|
+
if (kcNumberUnFormat === undefined) {
|
615
|
+
break unFormat_number;
|
616
|
+
}
|
617
|
+
valueOrValues = formatNumber(valueOrValues, kcNumberUnFormat);
|
618
|
+
}
|
619
|
+
return valueOrValues;
|
620
|
+
})();
|
621
|
+
if (value !== usernameValue) {
|
622
|
+
break check_password_policy_x;
|
623
|
+
}
|
624
|
+
const msgArgs = ["invalidPasswordNotUsernameMessage"];
|
625
|
+
errors.push({
|
626
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
627
|
+
"errorMessageStr": msgStr(...msgArgs),
|
628
|
+
"fieldIndex": undefined,
|
629
|
+
"source": {
|
630
|
+
"type": "passwordPolicy",
|
631
|
+
"name": policyName
|
632
|
+
}
|
633
|
+
});
|
634
|
+
}
|
635
|
+
check_password_policy_x: {
|
636
|
+
const policyName = "notEmail";
|
637
|
+
const notEmail = passwordPolicies[policyName];
|
638
|
+
if (!notEmail) {
|
639
|
+
break check_password_policy_x;
|
640
|
+
}
|
641
|
+
const emailFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "email");
|
642
|
+
if (emailFormFieldState === undefined) {
|
643
|
+
break check_password_policy_x;
|
644
|
+
}
|
645
|
+
assert(typeof emailFormFieldState.valueOrValues === "string");
|
646
|
+
{
|
647
|
+
const emailValue = emailFormFieldState.valueOrValues;
|
648
|
+
if (value !== emailValue) {
|
649
|
+
break check_password_policy_x;
|
650
|
+
}
|
651
|
+
}
|
652
|
+
const msgArgs = ["invalidPasswordNotEmailMessage"];
|
653
|
+
errors.push({
|
654
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
655
|
+
"errorMessageStr": msgStr(...msgArgs),
|
656
|
+
"fieldIndex": undefined,
|
657
|
+
"source": {
|
658
|
+
"type": "passwordPolicy",
|
659
|
+
"name": policyName
|
660
|
+
}
|
661
|
+
});
|
662
|
+
}
|
663
|
+
}
|
664
|
+
password_confirm_matches_password: {
|
665
|
+
if (attributeName !== "password-confirm") {
|
666
|
+
break password_confirm_matches_password;
|
667
|
+
}
|
668
|
+
const passwordFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "password");
|
669
|
+
assert(passwordFormFieldState !== undefined);
|
670
|
+
assert(typeof passwordFormFieldState.valueOrValues === "string");
|
671
|
+
{
|
672
|
+
const passwordValue = passwordFormFieldState.valueOrValues;
|
673
|
+
if (value === passwordValue) {
|
674
|
+
break password_confirm_matches_password;
|
675
|
+
}
|
676
|
+
}
|
677
|
+
const msgArgs = ["invalidPasswordConfirmMessage"];
|
678
|
+
errors.push({
|
679
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
680
|
+
"errorMessageStr": msgStr(...msgArgs),
|
681
|
+
"fieldIndex": undefined,
|
682
|
+
"source": {
|
683
|
+
"type": "other",
|
684
|
+
"rule": "passwordConfirmMatchesPassword"
|
685
|
+
}
|
686
|
+
});
|
687
|
+
}
|
688
|
+
const { validators } = attribute;
|
689
|
+
required_field: {
|
690
|
+
if (!attribute.required) {
|
691
|
+
break required_field;
|
692
|
+
}
|
693
|
+
if (value !== "") {
|
694
|
+
break required_field;
|
695
|
+
}
|
696
|
+
const msgArgs = ["error-user-attribute-required"];
|
697
|
+
errors.push({
|
698
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
699
|
+
"errorMessageStr": msgStr(...msgArgs),
|
700
|
+
"fieldIndex": undefined,
|
701
|
+
"source": {
|
702
|
+
"type": "other",
|
703
|
+
"rule": "requiredField"
|
704
|
+
}
|
705
|
+
});
|
706
|
+
}
|
707
|
+
validator_x: {
|
708
|
+
const validatorName = "length";
|
709
|
+
const validator = validators[validatorName];
|
710
|
+
if (validator === undefined) {
|
711
|
+
break validator_x;
|
712
|
+
}
|
713
|
+
const { "ignore.empty.value": ignoreEmptyValue = false, max, min } = validator;
|
714
|
+
if (ignoreEmptyValue && value === "") {
|
715
|
+
break validator_x;
|
716
|
+
}
|
717
|
+
const source = {
|
718
|
+
"type": "validator",
|
719
|
+
"name": validatorName
|
720
|
+
};
|
721
|
+
if (max !== undefined && value.length > parseInt(`${max}`)) {
|
722
|
+
const msgArgs = ["error-invalid-length-too-long", `${max}`];
|
723
|
+
errors.push({
|
724
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
725
|
+
"errorMessageStr": msgStr(...msgArgs),
|
726
|
+
"fieldIndex": undefined,
|
727
|
+
source
|
728
|
+
});
|
729
|
+
}
|
730
|
+
if (min !== undefined && value.length < parseInt(`${min}`)) {
|
731
|
+
const msgArgs = ["error-invalid-length-too-short", `${min}`];
|
732
|
+
errors.push({
|
733
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
734
|
+
"errorMessageStr": msgStr(...msgArgs),
|
735
|
+
"fieldIndex": undefined,
|
736
|
+
source
|
737
|
+
});
|
738
|
+
}
|
739
|
+
}
|
740
|
+
validator_x: {
|
741
|
+
const validatorName = "pattern";
|
742
|
+
const validator = validators[validatorName];
|
743
|
+
if (validator === undefined) {
|
744
|
+
break validator_x;
|
745
|
+
}
|
746
|
+
const { "ignore.empty.value": ignoreEmptyValue = false, pattern, "error-message": errorMessageKey } = validator;
|
747
|
+
if (ignoreEmptyValue && value === "") {
|
748
|
+
break validator_x;
|
749
|
+
}
|
750
|
+
if (new RegExp(pattern).test(value)) {
|
751
|
+
break validator_x;
|
752
|
+
}
|
753
|
+
const msgArgs = [errorMessageKey !== null && errorMessageKey !== void 0 ? errorMessageKey : id("shouldMatchPattern"), pattern];
|
754
|
+
errors.push({
|
755
|
+
"errorMessage": _jsx(Fragment, { children: advancedMsg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
756
|
+
"errorMessageStr": advancedMsgStr(...msgArgs),
|
757
|
+
"fieldIndex": undefined,
|
758
|
+
"source": {
|
759
|
+
"type": "validator",
|
760
|
+
"name": validatorName
|
761
|
+
}
|
762
|
+
});
|
763
|
+
}
|
764
|
+
validator_x: {
|
765
|
+
{
|
766
|
+
const lastError = errors[errors.length - 1];
|
767
|
+
if (lastError !== undefined && lastError.source.type === "validator" && lastError.source.name === "pattern") {
|
768
|
+
break validator_x;
|
769
|
+
}
|
770
|
+
}
|
771
|
+
const validatorName = "email";
|
772
|
+
const validator = validators[validatorName];
|
773
|
+
if (validator === undefined) {
|
774
|
+
break validator_x;
|
775
|
+
}
|
776
|
+
const { "ignore.empty.value": ignoreEmptyValue = false } = validator;
|
777
|
+
if (ignoreEmptyValue && value === "") {
|
778
|
+
break validator_x;
|
779
|
+
}
|
780
|
+
if (emailRegexp.test(value)) {
|
781
|
+
break validator_x;
|
782
|
+
}
|
783
|
+
const msgArgs = [id("invalidEmailMessage")];
|
784
|
+
errors.push({
|
785
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
786
|
+
"errorMessageStr": msgStr(...msgArgs),
|
787
|
+
"fieldIndex": undefined,
|
788
|
+
"source": {
|
789
|
+
"type": "validator",
|
790
|
+
"name": validatorName
|
791
|
+
}
|
792
|
+
});
|
793
|
+
}
|
794
|
+
validator_x: {
|
795
|
+
const validatorName = "integer";
|
796
|
+
const validator = validators[validatorName];
|
797
|
+
if (validator === undefined) {
|
798
|
+
break validator_x;
|
799
|
+
}
|
800
|
+
const { "ignore.empty.value": ignoreEmptyValue = false, max, min } = validator;
|
801
|
+
if (ignoreEmptyValue && value === "") {
|
802
|
+
break validator_x;
|
803
|
+
}
|
804
|
+
const intValue = parseInt(value);
|
805
|
+
const source = {
|
806
|
+
"type": "validator",
|
807
|
+
"name": validatorName
|
808
|
+
};
|
809
|
+
if (isNaN(intValue)) {
|
810
|
+
const msgArgs = ["mustBeAnInteger"];
|
811
|
+
errors.push({
|
812
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
813
|
+
"errorMessageStr": msgStr(...msgArgs),
|
814
|
+
"fieldIndex": undefined,
|
815
|
+
source
|
816
|
+
});
|
817
|
+
break validator_x;
|
818
|
+
}
|
819
|
+
if (max !== undefined && intValue > parseInt(`${max}`)) {
|
820
|
+
const msgArgs = ["error-number-out-of-range-too-big", `${max}`];
|
821
|
+
errors.push({
|
822
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
823
|
+
"errorMessageStr": msgStr(...msgArgs),
|
824
|
+
"fieldIndex": undefined,
|
825
|
+
source
|
826
|
+
});
|
827
|
+
break validator_x;
|
828
|
+
}
|
829
|
+
if (min !== undefined && intValue < parseInt(`${min}`)) {
|
830
|
+
const msgArgs = ["error-number-out-of-range-too-small", `${min}`];
|
831
|
+
errors.push({
|
832
|
+
"errorMessage": _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
833
|
+
"errorMessageStr": msgStr(...msgArgs),
|
834
|
+
"fieldIndex": undefined,
|
835
|
+
source
|
836
|
+
});
|
837
|
+
break validator_x;
|
838
|
+
}
|
839
|
+
}
|
840
|
+
validator_x: {
|
841
|
+
const validatorName = "options";
|
842
|
+
const validator = validators[validatorName];
|
843
|
+
if (validator === undefined) {
|
844
|
+
break validator_x;
|
845
|
+
}
|
846
|
+
if (value === "") {
|
847
|
+
break validator_x;
|
848
|
+
}
|
849
|
+
if (validator.options.indexOf(value) >= 0) {
|
850
|
+
break validator_x;
|
851
|
+
}
|
852
|
+
const msgArgs = [id("notAValidOption")];
|
853
|
+
errors.push({
|
854
|
+
"errorMessage": _jsx(Fragment, { children: advancedMsg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
855
|
+
"errorMessageStr": advancedMsgStr(...msgArgs),
|
856
|
+
"fieldIndex": undefined,
|
857
|
+
"source": {
|
858
|
+
"type": "validator",
|
859
|
+
"name": validatorName
|
860
|
+
}
|
861
|
+
});
|
862
|
+
}
|
863
|
+
//TODO: Implement missing validators. See Validators type definition.
|
864
|
+
return errors;
|
865
|
+
});
|
866
|
+
return { getErrors };
|
867
|
+
}
|
868
|
+
//# sourceMappingURL=useUserProfileForm.js.map
|