@keycloakify/angular 0.0.1-rc.0 → 0.0.1-rc.3
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/lib/i18n.d.ts +2 -2
- package/lib/i18n.mjs +6 -0
- package/lib/models/index.d.ts +1 -1
- package/lib/models/index.mjs +2 -0
- package/lib/models/script.model.mjs +2 -0
- package/lib/providers/keycloakify-angular.providers.d.ts +5 -5
- package/lib/providers/keycloakify-angular.providers.mjs +54 -0
- package/lib/public-api.d.ts +5 -5
- package/lib/public-api.mjs +4 -0
- package/lib/services/i18n.service.d.ts +3 -0
- package/lib/services/i18n.service.mjs +11 -0
- package/lib/services/index.d.ts +2 -2
- package/lib/services/index.mjs +3 -0
- package/lib/services/resource-injector.service.d.ts +5 -2
- package/lib/services/resource-injector.service.mjs +54 -0
- package/login/DefaultPage.d.ts +4 -4
- package/login/DefaultPage.mjs +121 -0
- package/login/KcContext.d.ts +1 -1
- package/login/KcContext.mjs +2 -0
- package/login/classes/component-reference.class.d.ts +1 -1
- package/login/classes/component-reference.class.mjs +3 -0
- package/login/components/add-remove-buttons-multi-valued-attribute/add-remove-buttons-multi-valued-attribute.component.d.ts +5 -2
- package/login/components/add-remove-buttons-multi-valued-attribute/add-remove-buttons-multi-valued-attribute.component.mjs +105 -0
- package/login/components/field-errors/field-errors.component.d.ts +7 -4
- package/login/components/field-errors/field-errors.component.mjs +32 -0
- package/login/components/group-label/group-label.component.d.ts +6 -3
- package/login/components/group-label/group-label.component.mjs +41 -0
- package/login/components/hello-world/hello-world.component.d.ts +5 -0
- package/login/components/hello-world/hello-world.component.mjs +11 -0
- package/login/components/index.d.ts +11 -11
- package/login/components/index.mjs +12 -0
- package/login/components/input-field-by-type/input-field-by-type.component.d.ts +7 -4
- package/login/components/input-field-by-type/input-field-by-type.component.mjs +45 -0
- package/login/components/input-tag/input-tag.component.d.ts +7 -4
- package/login/components/input-tag/input-tag.component.mjs +89 -0
- package/login/components/input-tag-selects/input-tag-selects.component.d.ts +9 -6
- package/login/components/input-tag-selects/input-tag-selects.component.mjs +115 -0
- package/login/components/logout-other-sessions/logout-other-sessions.component.d.ts +5 -2
- package/login/components/logout-other-sessions/logout-other-sessions.component.mjs +30 -0
- package/login/components/password-wrapper/password-wrapper.component.d.ts +6 -3
- package/login/components/password-wrapper/password-wrapper.component.mjs +44 -0
- package/login/components/select-tag/select-tag.component.d.ts +7 -4
- package/login/components/select-tag/select-tag.component.mjs +80 -0
- package/login/components/textarea-tag/textarea-tag.component.d.ts +7 -4
- package/login/components/textarea-tag/textarea-tag.component.mjs +48 -0
- package/login/components/user-profile-form-fields/user-profile-form-fields.component.d.ts +8 -5
- package/login/components/user-profile-form-fields/user-profile-form-fields.component.mjs +55 -0
- package/login/containers/template.component.d.ts +11 -8
- package/login/containers/template.component.mjs +70 -0
- package/login/directives/attributes.directive.d.ts +3 -0
- package/login/directives/attributes.directive.mjs +26 -0
- package/login/directives/index.d.ts +2 -2
- package/login/directives/index.mjs +3 -0
- package/login/directives/kc-class.directive.d.ts +5 -2
- package/login/directives/kc-class.directive.mjs +138 -0
- package/login/i18n.d.ts +2 -2
- package/login/i18n.mjs +2 -0
- package/login/pages/code/code.component.d.ts +6 -3
- package/login/pages/code/code.component.mjs +32 -0
- package/login/pages/delete-account-confirm/delete-account-confirm.component.d.ts +6 -3
- package/login/pages/delete-account-confirm/delete-account-confirm.component.mjs +32 -0
- package/login/pages/delete-credential/delete-credential.component.d.ts +6 -3
- package/login/pages/delete-credential/delete-credential.component.mjs +37 -0
- package/login/pages/error/error.component.d.ts +6 -3
- package/login/pages/error/error.component.mjs +32 -0
- package/login/pages/frontchannel-logout/frontchannel-logout.component.d.ts +7 -4
- package/login/pages/frontchannel-logout/frontchannel-logout.component.mjs +41 -0
- package/login/pages/idp-review-user-profile/idp-review-user-profile.component.d.ts +6 -3
- package/login/pages/idp-review-user-profile/idp-review-user-profile.component.mjs +42 -0
- package/login/pages/info/info.component.d.ts +9 -6
- package/login/pages/info/info.component.mjs +58 -0
- package/login/pages/login/login.component.d.ts +6 -3
- package/login/pages/login/login.component.mjs +41 -0
- package/login/pages/login-config-totp/login-config-totp.component.d.ts +6 -3
- package/login/pages/login-config-totp/login-config-totp.component.mjs +40 -0
- package/login/pages/login-idp-link-confirm/login-idp-link-confirm.component.d.ts +6 -3
- package/login/pages/login-idp-link-confirm/login-idp-link-confirm.component.mjs +37 -0
- package/login/pages/login-idp-link-confirm-override/login-idp-link-confirm-override.component.d.ts +6 -3
- package/login/pages/login-idp-link-confirm-override/login-idp-link-confirm-override.component.mjs +37 -0
- package/login/pages/login-idp-link-email/login-idp-link-email.component.d.ts +6 -3
- package/login/pages/login-idp-link-email/login-idp-link-email.component.mjs +37 -0
- package/login/pages/login-oauth-grant/login-oauth-grant.component.d.ts +6 -3
- package/login/pages/login-oauth-grant/login-oauth-grant.component.mjs +38 -0
- package/login/pages/login-oauth2-device-verify-user-code/login-oauth2-device-verify-user-code.component.d.ts +6 -3
- package/login/pages/login-oauth2-device-verify-user-code/login-oauth2-device-verify-user-code.component.mjs +37 -0
- package/login/pages/login-otp/login-otp.component.d.ts +6 -3
- package/login/pages/login-otp/login-otp.component.mjs +38 -0
- package/login/pages/login-page-expired/login-page-expired.component.d.ts +6 -3
- package/login/pages/login-page-expired/login-page-expired.component.mjs +36 -0
- package/login/pages/login-passkeys-conditional-authenticate/login-passkeys-conditional-authenticate.component.d.ts +8 -5
- package/login/pages/login-passkeys-conditional-authenticate/login-passkeys-conditional-authenticate.component.mjs +85 -0
- package/login/pages/login-password/login-password.component.d.ts +6 -3
- package/login/pages/login-password/login-password.component.mjs +40 -0
- package/login/pages/login-recovery-authn-code-config/login-recovery-authn-code-config.component.d.ts +6 -3
- package/login/pages/login-recovery-authn-code-config/login-recovery-authn-code-config.component.mjs +40 -0
- package/login/pages/login-recovery-authn-code-input/login-recovery-authn-code-input.component.d.ts +6 -3
- package/login/pages/login-recovery-authn-code-input/login-recovery-authn-code-input.component.mjs +38 -0
- package/login/pages/login-reset-otp/login-reset-otp.component.d.ts +6 -3
- package/login/pages/login-reset-otp/login-reset-otp.component.mjs +37 -0
- package/login/pages/login-reset-password/login-reset-password.component.d.ts +6 -3
- package/login/pages/login-reset-password/login-reset-password.component.mjs +38 -0
- package/login/pages/login-update-password/login-update-password.component.d.ts +6 -3
- package/login/pages/login-update-password/login-update-password.component.mjs +40 -0
- package/login/pages/login-update-profile/login-update-profile.component.d.ts +6 -3
- package/login/pages/login-update-profile/login-update-profile.component.mjs +39 -0
- package/login/pages/login-username/login-username.component.d.ts +6 -3
- package/login/pages/login-username/login-username.component.mjs +40 -0
- package/login/pages/login-verify-email/login-verify-email.component.d.ts +6 -3
- package/login/pages/login-verify-email/login-verify-email.component.mjs +37 -0
- package/login/pages/login-x509-info/login-x509-info.component.d.ts +6 -3
- package/login/pages/login-x509-info/login-x509-info.component.mjs +37 -0
- package/login/pages/logout-confirm/logout-confirm.component.d.ts +6 -3
- package/login/pages/logout-confirm/logout-confirm.component.mjs +37 -0
- package/login/pages/register/register.component.d.ts +6 -3
- package/login/pages/register/register.component.mjs +55 -0
- package/login/pages/saml-post-form/saml-post-form.component.d.ts +7 -4
- package/login/pages/saml-post-form/saml-post-form.component.mjs +49 -0
- package/login/pages/select-authenticator/select-authenticator.component.d.ts +6 -3
- package/login/pages/select-authenticator/select-authenticator.component.mjs +39 -0
- package/login/pages/terms/terms.component.d.ts +6 -3
- package/login/pages/terms/terms.component.mjs +37 -0
- package/login/pages/update-email/update-email.component.d.ts +6 -3
- package/login/pages/update-email/update-email.component.mjs +40 -0
- package/login/pages/webauthn-authenticate/webauthn-authenticate.component.d.ts +8 -5
- package/login/pages/webauthn-authenticate/webauthn-authenticate.component.mjs +81 -0
- package/login/pages/webauthn-error/webauthn-error.component.d.ts +6 -3
- package/login/pages/webauthn-error/webauthn-error.component.mjs +46 -0
- package/login/pages/webauthn-register/webauthn-register.component.d.ts +8 -5
- package/login/pages/webauthn-register/webauthn-register.component.mjs +76 -0
- package/login/pipes/advanced-msg-str.pipe.d.ts +4 -1
- package/login/pipes/advanced-msg-str.pipe.mjs +19 -0
- package/login/pipes/index.d.ts +6 -6
- package/login/pipes/index.mjs +7 -0
- package/login/pipes/input-type.pipe.d.ts +4 -1
- package/login/pipes/input-type.pipe.mjs +20 -0
- package/login/pipes/kc-sanitize.pipe.d.ts +5 -2
- package/login/pipes/kc-sanitize.pipe.mjs +34 -0
- package/login/pipes/msg-str.pipe.d.ts +5 -2
- package/login/pipes/msg-str.pipe.mjs +19 -0
- package/login/pipes/to-array.pipe.d.ts +4 -1
- package/login/pipes/to-array.pipe.mjs +21 -0
- package/login/pipes/to-number.pipe.d.ts +4 -1
- package/login/pipes/to-number.pipe.mjs +20 -0
- package/login/services/index.d.ts +2 -2
- package/login/services/index.mjs +3 -0
- package/login/services/login-resource-injector.service.d.ts +4 -1
- package/login/services/login-resource-injector.service.mjs +68 -0
- package/login/services/user-profile-form.service.d.ts +15 -12
- package/login/services/user-profile-form.service.mjs +1017 -0
- package/package.json +94 -204
- package/src/lib/i18n.ts +2 -2
- package/src/lib/models/index.ts +1 -1
- package/src/lib/providers/keycloakify-angular.providers.ts +18 -18
- package/src/lib/public-api.ts +5 -5
- package/src/lib/services/i18n.service.ts +2 -2
- package/src/lib/services/index.ts +2 -2
- package/src/lib/services/resource-injector.service.ts +7 -7
- package/src/login/DefaultPage.ts +76 -76
- package/src/login/KcContext.ts +1 -1
- package/src/login/classes/component-reference.class.ts +1 -1
- package/src/login/components/add-remove-buttons-multi-valued-attribute/add-remove-buttons-multi-valued-attribute.component.html +19 -19
- package/src/login/components/add-remove-buttons-multi-valued-attribute/add-remove-buttons-multi-valued-attribute.component.ts +12 -22
- package/src/login/components/field-errors/field-errors.component.html +10 -10
- package/src/login/components/field-errors/field-errors.component.ts +9 -15
- package/src/login/components/group-label/group-label.component.html +25 -25
- package/src/login/components/group-label/group-label.component.ts +12 -19
- package/src/login/components/hello-world/hello-world.component.css +0 -0
- package/src/login/components/hello-world/hello-world.component.html +1 -0
- package/src/login/components/hello-world/hello-world.component.ts +10 -0
- package/src/login/components/index.ts +11 -11
- package/src/login/components/input-field-by-type/input-field-by-type.component.html +57 -57
- package/src/login/components/input-field-by-type/input-field-by-type.component.ts +16 -34
- package/src/login/components/input-tag/input-tag.component.html +41 -45
- package/src/login/components/input-tag/input-tag.component.ts +20 -31
- package/src/login/components/input-tag-selects/input-tag-selects.component.html +22 -22
- package/src/login/components/input-tag-selects/input-tag-selects.component.ts +27 -41
- package/src/login/components/logout-other-sessions/logout-other-sessions.component.html +15 -15
- package/src/login/components/logout-other-sessions/logout-other-sessions.component.ts +8 -8
- package/src/login/components/password-wrapper/password-wrapper.component.html +13 -13
- package/src/login/components/password-wrapper/password-wrapper.component.ts +10 -23
- package/src/login/components/select-tag/select-tag.component.html +26 -26
- package/src/login/components/select-tag/select-tag.component.ts +18 -33
- package/src/login/components/textarea-tag/textarea-tag.component.html +13 -15
- package/src/login/components/textarea-tag/textarea-tag.component.ts +14 -24
- package/src/login/components/user-profile-form-fields/user-profile-form-fields.component.html +71 -71
- package/src/login/components/user-profile-form-fields/user-profile-form-fields.component.ts +17 -41
- package/src/login/containers/template.component.html +183 -183
- package/src/login/containers/template.component.ts +20 -38
- package/src/login/directives/attributes.directive.ts +2 -2
- package/src/login/directives/index.ts +2 -2
- package/src/login/directives/kc-class.directive.ts +11 -11
- package/src/login/i18n.ts +2 -2
- package/src/login/pages/code/code.component.html +21 -21
- package/src/login/pages/code/code.component.ts +11 -15
- package/src/login/pages/delete-account-confirm/delete-account-confirm.component.html +44 -42
- package/src/login/pages/delete-account-confirm/delete-account-confirm.component.ts +11 -16
- package/src/login/pages/delete-credential/delete-credential.component.html +29 -29
- package/src/login/pages/delete-credential/delete-credential.component.ts +11 -22
- package/src/login/pages/error/error.component.html +20 -20
- package/src/login/pages/error/error.component.ts +11 -15
- package/src/login/pages/frontchannel-logout/frontchannel-logout.component.html +31 -31
- package/src/login/pages/frontchannel-logout/frontchannel-logout.component.ts +11 -23
- package/src/login/pages/idp-review-user-profile/idp-review-user-profile.component.html +36 -36
- package/src/login/pages/idp-review-user-profile/idp-review-user-profile.component.ts +15 -32
- package/src/login/pages/info/info.component.html +45 -45
- package/src/login/pages/info/info.component.ts +16 -28
- package/src/login/pages/login/login.component.html +194 -194
- package/src/login/pages/login/login.component.ts +17 -42
- package/src/login/pages/login-config-totp/login-config-totp.component.html +189 -179
- package/src/login/pages/login-config-totp/login-config-totp.component.ts +16 -37
- package/src/login/pages/login-idp-link-confirm/login-idp-link-confirm.component.html +35 -35
- package/src/login/pages/login-idp-link-confirm/login-idp-link-confirm.component.ts +11 -22
- package/src/login/pages/login-idp-link-confirm-override/login-idp-link-confirm-override.component.html +34 -34
- package/src/login/pages/login-idp-link-confirm-override/login-idp-link-confirm-override.component.ts +11 -24
- package/src/login/pages/login-idp-link-email/login-idp-link-email.component.html +32 -30
- package/src/login/pages/login-idp-link-email/login-idp-link-email.component.ts +11 -22
- package/src/login/pages/login-oauth-grant/login-oauth-grant.component.html +83 -81
- package/src/login/pages/login-oauth-grant/login-oauth-grant.component.ts +13 -24
- package/src/login/pages/login-oauth2-device-verify-user-code/login-oauth2-device-verify-user-code.component.html +57 -57
- package/src/login/pages/login-oauth2-device-verify-user-code/login-oauth2-device-verify-user-code.component.ts +11 -24
- package/src/login/pages/login-otp/login-otp.component.html +96 -96
- package/src/login/pages/login-otp/login-otp.component.ts +13 -23
- package/src/login/pages/login-page-expired/login-page-expired.component.html +31 -31
- package/src/login/pages/login-page-expired/login-page-expired.component.ts +10 -21
- package/src/login/pages/login-passkeys-conditional-authenticate/login-passkeys-conditional-authenticate.component.html +183 -181
- package/src/login/pages/login-passkeys-conditional-authenticate/login-passkeys-conditional-authenticate.component.ts +21 -28
- package/src/login/pages/login-password/login-password.component.html +82 -82
- package/src/login/pages/login-password/login-password.component.ts +15 -32
- package/src/login/pages/login-recovery-authn-code-config/login-recovery-authn-code-config.component.html +142 -142
- package/src/login/pages/login-recovery-authn-code-config/login-recovery-authn-code-config.component.ts +14 -33
- package/src/login/pages/login-recovery-authn-code-input/login-recovery-authn-code-input.component.html +67 -67
- package/src/login/pages/login-recovery-authn-code-input/login-recovery-authn-code-input.component.ts +13 -27
- package/src/login/pages/login-reset-otp/login-reset-otp.component.html +61 -59
- package/src/login/pages/login-reset-otp/login-reset-otp.component.ts +12 -22
- package/src/login/pages/login-reset-password/login-reset-password.component.html +84 -84
- package/src/login/pages/login-reset-password/login-reset-password.component.ts +13 -24
- package/src/login/pages/login-update-password/login-update-password.component.html +107 -107
- package/src/login/pages/login-update-password/login-update-password.component.ts +16 -37
- package/src/login/pages/login-update-profile/login-update-profile.component.html +53 -53
- package/src/login/pages/login-update-profile/login-update-profile.component.ts +14 -31
- package/src/login/pages/login-username/login-username.component.html +146 -146
- package/src/login/pages/login-username/login-username.component.ts +16 -37
- package/src/login/pages/login-verify-email/login-verify-email.component.html +22 -22
- package/src/login/pages/login-verify-email/login-verify-email.component.ts +11 -22
- package/src/login/pages/login-x509-info/login-x509-info.component.html +96 -96
- package/src/login/pages/login-x509-info/login-x509-info.component.ts +11 -21
- package/src/login/pages/logout-confirm/logout-confirm.component.html +51 -51
- package/src/login/pages/logout-confirm/logout-confirm.component.ts +11 -21
- package/src/login/pages/register/register.component.html +113 -113
- package/src/login/pages/register/register.component.ts +17 -28
- package/src/login/pages/saml-post-form/saml-post-form.component.html +47 -48
- package/src/login/pages/saml-post-form/saml-post-form.component.ts +13 -25
- package/src/login/pages/select-authenticator/select-authenticator.component.html +43 -44
- package/src/login/pages/select-authenticator/select-authenticator.component.ts +14 -31
- package/src/login/pages/terms/terms.component.html +32 -32
- package/src/login/pages/terms/terms.component.ts +11 -21
- package/src/login/pages/update-email/update-email.component.html +52 -52
- package/src/login/pages/update-email/update-email.component.ts +15 -32
- package/src/login/pages/webauthn-authenticate/webauthn-authenticate.component.html +146 -148
- package/src/login/pages/webauthn-authenticate/webauthn-authenticate.component.ts +23 -47
- package/src/login/pages/webauthn-error/webauthn-error.component.html +53 -53
- package/src/login/pages/webauthn-error/webauthn-error.component.ts +16 -31
- package/src/login/pages/webauthn-register/webauthn-register.component.html +73 -73
- package/src/login/pages/webauthn-register/webauthn-register.component.ts +21 -37
- package/src/login/pipes/advanced-msg-str.pipe.ts +4 -4
- package/src/login/pipes/index.ts +6 -6
- package/src/login/pipes/input-type.pipe.ts +4 -4
- package/src/login/pipes/kc-sanitize.pipe.ts +8 -8
- package/src/login/pipes/msg-str.pipe.ts +5 -5
- package/src/login/pipes/to-array.pipe.ts +2 -2
- package/src/login/pipes/to-number.pipe.ts +3 -3
- package/src/login/services/index.ts +2 -2
- package/src/login/services/login-resource-injector.service.ts +11 -11
- package/src/login/services/user-profile-form.service.ts +178 -178
- package/src/tsconfig.json +0 -1
- package/stories/login/pages/login/login.stories.ts +146 -0
- package/lib/i18n.js +0 -6
- package/lib/i18n.js.map +0 -1
- package/lib/models/index.js +0 -2
- package/lib/models/index.js.map +0 -1
- package/lib/models/script.model.js +0 -2
- package/lib/models/script.model.js.map +0 -1
- package/lib/providers/keycloakify-angular.providers.js +0 -58
- package/lib/providers/keycloakify-angular.providers.js.map +0 -1
- package/lib/public-api.js +0 -4
- package/lib/public-api.js.map +0 -1
- package/lib/services/i18n.service.js +0 -14
- package/lib/services/i18n.service.js.map +0 -1
- package/lib/services/index.js +0 -3
- package/lib/services/index.js.map +0 -1
- package/lib/services/resource-injector.service.js +0 -57
- package/lib/services/resource-injector.service.js.map +0 -1
- package/login/DefaultPage.js +0 -121
- package/login/DefaultPage.js.map +0 -1
- package/login/KcContext.js +0 -2
- package/login/KcContext.js.map +0 -1
- package/login/classes/component-reference.class.js +0 -3
- package/login/classes/component-reference.class.js.map +0 -1
- package/login/components/add-remove-buttons-multi-valued-attribute/add-remove-buttons-multi-valued-attribute.component.html +0 -24
- package/login/components/add-remove-buttons-multi-valued-attribute/add-remove-buttons-multi-valued-attribute.component.js +0 -123
- package/login/components/add-remove-buttons-multi-valued-attribute/add-remove-buttons-multi-valued-attribute.component.js.map +0 -1
- package/login/components/field-errors/field-errors.component.html +0 -15
- package/login/components/field-errors/field-errors.component.js +0 -45
- package/login/components/field-errors/field-errors.component.js.map +0 -1
- package/login/components/group-label/group-label.component.html +0 -30
- package/login/components/group-label/group-label.component.js +0 -55
- package/login/components/group-label/group-label.component.js.map +0 -1
- package/login/components/index.js +0 -12
- package/login/components/index.js.map +0 -1
- package/login/components/input-field-by-type/input-field-by-type.component.html +0 -63
- package/login/components/input-field-by-type/input-field-by-type.component.js +0 -63
- package/login/components/input-field-by-type/input-field-by-type.component.js.map +0 -1
- package/login/components/input-tag/input-tag.component.html +0 -49
- package/login/components/input-tag/input-tag.component.js +0 -107
- package/login/components/input-tag/input-tag.component.js.map +0 -1
- package/login/components/input-tag-selects/input-tag-selects.component.html +0 -29
- package/login/components/input-tag-selects/input-tag-selects.component.js +0 -132
- package/login/components/input-tag-selects/input-tag-selects.component.js.map +0 -1
- package/login/components/logout-other-sessions/logout-other-sessions.component.html +0 -19
- package/login/components/logout-other-sessions/logout-other-sessions.component.js +0 -43
- package/login/components/logout-other-sessions/logout-other-sessions.component.js.map +0 -1
- package/login/components/password-wrapper/password-wrapper.component.html +0 -15
- package/login/components/password-wrapper/password-wrapper.component.js +0 -57
- package/login/components/password-wrapper/password-wrapper.component.js.map +0 -1
- package/login/components/select-tag/select-tag.component.html +0 -31
- package/login/components/select-tag/select-tag.component.js +0 -97
- package/login/components/select-tag/select-tag.component.js.map +0 -1
- package/login/components/textarea-tag/textarea-tag.component.html +0 -18
- package/login/components/textarea-tag/textarea-tag.component.js +0 -63
- package/login/components/textarea-tag/textarea-tag.component.js.map +0 -1
- package/login/components/user-profile-form-fields/user-profile-form-fields.component.html +0 -85
- package/login/components/user-profile-form-fields/user-profile-form-fields.component.js +0 -74
- package/login/components/user-profile-form-fields/user-profile-form-fields.component.js.map +0 -1
- package/login/containers/template.component.html +0 -203
- package/login/containers/template.component.js +0 -78
- package/login/containers/template.component.js.map +0 -1
- package/login/directives/attributes.directive.js +0 -34
- package/login/directives/attributes.directive.js.map +0 -1
- package/login/directives/index.js +0 -3
- package/login/directives/index.js.map +0 -1
- package/login/directives/kc-class.directive.js +0 -146
- package/login/directives/kc-class.directive.js.map +0 -1
- package/login/i18n.js +0 -2
- package/login/i18n.js.map +0 -1
- package/login/pages/code/code.component.html +0 -26
- package/login/pages/code/code.component.js +0 -38
- package/login/pages/code/code.component.js.map +0 -1
- package/login/pages/delete-account-confirm/delete-account-confirm.component.html +0 -46
- package/login/pages/delete-account-confirm/delete-account-confirm.component.js +0 -38
- package/login/pages/delete-account-confirm/delete-account-confirm.component.js.map +0 -1
- package/login/pages/delete-credential/delete-credential.component.html +0 -35
- package/login/pages/delete-credential/delete-credential.component.js +0 -43
- package/login/pages/delete-credential/delete-credential.component.js.map +0 -1
- package/login/pages/error/error.component.html +0 -25
- package/login/pages/error/error.component.js +0 -38
- package/login/pages/error/error.component.js.map +0 -1
- package/login/pages/frontchannel-logout/frontchannel-logout.component.html +0 -35
- package/login/pages/frontchannel-logout/frontchannel-logout.component.js +0 -47
- package/login/pages/frontchannel-logout/frontchannel-logout.component.js.map +0 -1
- package/login/pages/idp-review-user-profile/idp-review-user-profile.component.html +0 -41
- package/login/pages/idp-review-user-profile/idp-review-user-profile.component.js +0 -54
- package/login/pages/idp-review-user-profile/idp-review-user-profile.component.js.map +0 -1
- package/login/pages/info/info.component.html +0 -54
- package/login/pages/info/info.component.js +0 -61
- package/login/pages/info/info.component.js.map +0 -1
- package/login/pages/login/login.component.html +0 -212
- package/login/pages/login/login.component.js +0 -58
- package/login/pages/login/login.component.js.map +0 -1
- package/login/pages/login-config-totp/login-config-totp.component.html +0 -190
- package/login/pages/login-config-totp/login-config-totp.component.js +0 -53
- package/login/pages/login-config-totp/login-config-totp.component.js.map +0 -1
- package/login/pages/login-idp-link-confirm/login-idp-link-confirm.component.html +0 -41
- package/login/pages/login-idp-link-confirm/login-idp-link-confirm.component.js +0 -43
- package/login/pages/login-idp-link-confirm/login-idp-link-confirm.component.js.map +0 -1
- package/login/pages/login-idp-link-confirm-override/login-idp-link-confirm-override.component.html +0 -40
- package/login/pages/login-idp-link-confirm-override/login-idp-link-confirm-override.component.js +0 -43
- package/login/pages/login-idp-link-confirm-override/login-idp-link-confirm-override.component.js.map +0 -1
- package/login/pages/login-idp-link-email/login-idp-link-email.component.html +0 -37
- package/login/pages/login-idp-link-email/login-idp-link-email.component.js +0 -43
- package/login/pages/login-idp-link-email/login-idp-link-email.component.js.map +0 -1
- package/login/pages/login-oauth-grant/login-oauth-grant.component.html +0 -92
- package/login/pages/login-oauth-grant/login-oauth-grant.component.js +0 -44
- package/login/pages/login-oauth-grant/login-oauth-grant.component.js.map +0 -1
- package/login/pages/login-oauth2-device-verify-user-code/login-oauth2-device-verify-user-code.component.html +0 -63
- package/login/pages/login-oauth2-device-verify-user-code/login-oauth2-device-verify-user-code.component.js +0 -43
- package/login/pages/login-oauth2-device-verify-user-code/login-oauth2-device-verify-user-code.component.js.map +0 -1
- package/login/pages/login-otp/login-otp.component.html +0 -103
- package/login/pages/login-otp/login-otp.component.js +0 -44
- package/login/pages/login-otp/login-otp.component.js.map +0 -1
- package/login/pages/login-page-expired/login-page-expired.component.html +0 -35
- package/login/pages/login-page-expired/login-page-expired.component.js +0 -42
- package/login/pages/login-page-expired/login-page-expired.component.js.map +0 -1
- package/login/pages/login-passkeys-conditional-authenticate/login-passkeys-conditional-authenticate.component.html +0 -203
- package/login/pages/login-passkeys-conditional-authenticate/login-passkeys-conditional-authenticate.component.js +0 -91
- package/login/pages/login-passkeys-conditional-authenticate/login-passkeys-conditional-authenticate.component.js.map +0 -1
- package/login/pages/login-password/login-password.component.html +0 -90
- package/login/pages/login-password/login-password.component.js +0 -52
- package/login/pages/login-password/login-password.component.js.map +0 -1
- package/login/pages/login-recovery-authn-code-config/login-recovery-authn-code-config.component.html +0 -155
- package/login/pages/login-recovery-authn-code-config/login-recovery-authn-code-config.component.js +0 -51
- package/login/pages/login-recovery-authn-code-config/login-recovery-authn-code-config.component.js.map +0 -1
- package/login/pages/login-recovery-authn-code-input/login-recovery-authn-code-input.component.html +0 -76
- package/login/pages/login-recovery-authn-code-input/login-recovery-authn-code-input.component.js +0 -44
- package/login/pages/login-recovery-authn-code-input/login-recovery-authn-code-input.component.js.map +0 -1
- package/login/pages/login-reset-otp/login-reset-otp.component.html +0 -65
- package/login/pages/login-reset-otp/login-reset-otp.component.js +0 -43
- package/login/pages/login-reset-otp/login-reset-otp.component.js.map +0 -1
- package/login/pages/login-reset-password/login-reset-password.component.html +0 -95
- package/login/pages/login-reset-password/login-reset-password.component.js +0 -44
- package/login/pages/login-reset-password/login-reset-password.component.js.map +0 -1
- package/login/pages/login-update-password/login-update-password.component.html +0 -116
- package/login/pages/login-update-password/login-update-password.component.js +0 -53
- package/login/pages/login-update-password/login-update-password.component.js.map +0 -1
- package/login/pages/login-update-profile/login-update-profile.component.html +0 -59
- package/login/pages/login-update-profile/login-update-profile.component.js +0 -50
- package/login/pages/login-update-profile/login-update-profile.component.js.map +0 -1
- package/login/pages/login-username/login-username.component.html +0 -161
- package/login/pages/login-username/login-username.component.js +0 -56
- package/login/pages/login-username/login-username.component.js.map +0 -1
- package/login/pages/login-verify-email/login-verify-email.component.html +0 -27
- package/login/pages/login-verify-email/login-verify-email.component.js +0 -43
- package/login/pages/login-verify-email/login-verify-email.component.js.map +0 -1
- package/login/pages/login-x509-info/login-x509-info.component.html +0 -102
- package/login/pages/login-x509-info/login-x509-info.component.js +0 -43
- package/login/pages/login-x509-info/login-x509-info.component.js.map +0 -1
- package/login/pages/logout-confirm/logout-confirm.component.html +0 -59
- package/login/pages/logout-confirm/logout-confirm.component.js +0 -43
- package/login/pages/logout-confirm/logout-confirm.component.js.map +0 -1
- package/login/pages/register/register.component.html +0 -126
- package/login/pages/register/register.component.js +0 -62
- package/login/pages/register/register.component.js.map +0 -1
- package/login/pages/saml-post-form/saml-post-form.component.html +0 -51
- package/login/pages/saml-post-form/saml-post-form.component.js +0 -55
- package/login/pages/saml-post-form/saml-post-form.component.js.map +0 -1
- package/login/pages/select-authenticator/select-authenticator.component.html +0 -49
- package/login/pages/select-authenticator/select-authenticator.component.js +0 -51
- package/login/pages/select-authenticator/select-authenticator.component.js.map +0 -1
- package/login/pages/terms/terms.component.html +0 -36
- package/login/pages/terms/terms.component.js +0 -43
- package/login/pages/terms/terms.component.js.map +0 -1
- package/login/pages/update-email/update-email.component.html +0 -58
- package/login/pages/update-email/update-email.component.js +0 -52
- package/login/pages/update-email/update-email.component.js.map +0 -1
- package/login/pages/webauthn-authenticate/webauthn-authenticate.component.html +0 -162
- package/login/pages/webauthn-authenticate/webauthn-authenticate.component.js +0 -93
- package/login/pages/webauthn-authenticate/webauthn-authenticate.component.js.map +0 -1
- package/login/pages/webauthn-error/webauthn-error.component.html +0 -60
- package/login/pages/webauthn-error/webauthn-error.component.js +0 -57
- package/login/pages/webauthn-error/webauthn-error.component.js.map +0 -1
- package/login/pages/webauthn-register/webauthn-register.component.html +0 -82
- package/login/pages/webauthn-register/webauthn-register.component.js +0 -86
- package/login/pages/webauthn-register/webauthn-register.component.js.map +0 -1
- package/login/pipes/advanced-msg-str.pipe.js +0 -31
- package/login/pipes/advanced-msg-str.pipe.js.map +0 -1
- package/login/pipes/index.js +0 -7
- package/login/pipes/index.js.map +0 -1
- package/login/pipes/input-type.pipe.js +0 -23
- package/login/pipes/input-type.pipe.js.map +0 -1
- package/login/pipes/kc-sanitize.pipe.js +0 -36
- package/login/pipes/kc-sanitize.pipe.js.map +0 -1
- package/login/pipes/msg-str.pipe.js +0 -31
- package/login/pipes/msg-str.pipe.js.map +0 -1
- package/login/pipes/to-array.pipe.js +0 -24
- package/login/pipes/to-array.pipe.js.map +0 -1
- package/login/pipes/to-number.pipe.js +0 -23
- package/login/pipes/to-number.pipe.js.map +0 -1
- package/login/services/index.js +0 -3
- package/login/services/index.js.map +0 -1
- package/login/services/login-resource-injector.service.js +0 -71
- package/login/services/login-resource-injector.service.js.map +0 -1
- package/login/services/user-profile-form.service.js +0 -1031
- package/login/services/user-profile-form.service.js.map +0 -1
|
@@ -1,1031 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8
|
-
};
|
|
9
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
10
|
-
var t = {};
|
|
11
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
12
|
-
t[p] = s[p];
|
|
13
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
14
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
16
|
-
t[p[i]] = s[p[i]];
|
|
17
|
-
}
|
|
18
|
-
return t;
|
|
19
|
-
};
|
|
20
|
-
import { computed, inject, Injectable, signal } from "@angular/core";
|
|
21
|
-
import { DomSanitizer } from "@angular/platform-browser";
|
|
22
|
-
import { DO_MAKE_USER_CONFIRM_PASSWORD, I18N, KC_CONTEXT } from "../../lib/public-api";
|
|
23
|
-
import { emailRegexp } from "keycloakify/tools/emailRegExp";
|
|
24
|
-
import { formatNumber } from "keycloakify/tools/formatNumber";
|
|
25
|
-
import { structuredCloneButFunctions } from "keycloakify/tools/structuredCloneButFunctions";
|
|
26
|
-
import { assert, id } from "tsafe";
|
|
27
|
-
import { LoginResourceInjectorService } from "./login-resource-injector.service";
|
|
28
|
-
let UserProfileFormService = class UserProfileFormService {
|
|
29
|
-
constructor() {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
this.kcContext = inject(KC_CONTEXT);
|
|
32
|
-
this.i18n = inject(I18N);
|
|
33
|
-
this.doMakeUserConfirmPassword = inject(DO_MAKE_USER_CONFIRM_PASSWORD);
|
|
34
|
-
this.loginResourceInjectorService = inject(LoginResourceInjectorService);
|
|
35
|
-
this.sanitizer = inject(DomSanitizer);
|
|
36
|
-
this.initialState = (() => {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
const attributes = (() => {
|
|
39
|
-
var _a;
|
|
40
|
-
mock_user_profile_attributes_for_older_keycloak_versions: {
|
|
41
|
-
if ("profile" in this.kcContext &&
|
|
42
|
-
"attributesByName" in this.kcContext.profile &&
|
|
43
|
-
Object.keys(this.kcContext.profile.attributesByName).length !== 0) {
|
|
44
|
-
break mock_user_profile_attributes_for_older_keycloak_versions;
|
|
45
|
-
}
|
|
46
|
-
if ("register" in this.kcContext &&
|
|
47
|
-
this.kcContext.register instanceof Object &&
|
|
48
|
-
"formData" in this.kcContext.register) {
|
|
49
|
-
//NOTE: Handle legacy register.ftl page
|
|
50
|
-
return ["firstName", "lastName", "email", "username"]
|
|
51
|
-
.filter(name => name !== "username"
|
|
52
|
-
? true
|
|
53
|
-
: !this.kcContext.realm.registrationEmailAsUsername)
|
|
54
|
-
.map(name => {
|
|
55
|
-
var _a;
|
|
56
|
-
return id({
|
|
57
|
-
name: name,
|
|
58
|
-
displayName: id(`\${${name}}`),
|
|
59
|
-
required: true,
|
|
60
|
-
value: (_a = this.kcContext.register.formData[name]) !== null && _a !== void 0 ? _a : "",
|
|
61
|
-
html5DataAnnotations: {},
|
|
62
|
-
readOnly: false,
|
|
63
|
-
validators: {},
|
|
64
|
-
annotations: {},
|
|
65
|
-
autocomplete: (() => {
|
|
66
|
-
switch (name) {
|
|
67
|
-
case "email":
|
|
68
|
-
return "email";
|
|
69
|
-
case "username":
|
|
70
|
-
return "username";
|
|
71
|
-
default:
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
})()
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if ("user" in this.kcContext && this.kcContext.user instanceof Object) {
|
|
79
|
-
//NOTE: Handle legacy login-update-profile.ftl
|
|
80
|
-
return ["username", "email", "firstName", "lastName"]
|
|
81
|
-
.filter(name => name !== "username"
|
|
82
|
-
? true
|
|
83
|
-
: this.kcContext.user.editUsernameAllowed)
|
|
84
|
-
.map(name => {
|
|
85
|
-
var _a;
|
|
86
|
-
return id({
|
|
87
|
-
name: name,
|
|
88
|
-
displayName: id(`\${${name}}`),
|
|
89
|
-
required: true,
|
|
90
|
-
value: (_a = this.kcContext.user[name]) !== null && _a !== void 0 ? _a : "",
|
|
91
|
-
html5DataAnnotations: {},
|
|
92
|
-
readOnly: false,
|
|
93
|
-
validators: {},
|
|
94
|
-
annotations: {},
|
|
95
|
-
autocomplete: (() => {
|
|
96
|
-
switch (name) {
|
|
97
|
-
case "email":
|
|
98
|
-
return "email";
|
|
99
|
-
case "username":
|
|
100
|
-
return "username";
|
|
101
|
-
default:
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
})()
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
if ("email" in this.kcContext && this.kcContext.email instanceof Object) {
|
|
109
|
-
//NOTE: Handle legacy update-email.ftl
|
|
110
|
-
return [
|
|
111
|
-
id({
|
|
112
|
-
name: "email",
|
|
113
|
-
displayName: id(`\${email}`),
|
|
114
|
-
required: true,
|
|
115
|
-
value: (_a = this.kcContext.email.value) !== null && _a !== void 0 ? _a : "",
|
|
116
|
-
html5DataAnnotations: {},
|
|
117
|
-
readOnly: false,
|
|
118
|
-
validators: {},
|
|
119
|
-
annotations: {},
|
|
120
|
-
autocomplete: "email"
|
|
121
|
-
})
|
|
122
|
-
];
|
|
123
|
-
}
|
|
124
|
-
assert(false, "Unable to mock user profile from the current kcContext");
|
|
125
|
-
}
|
|
126
|
-
return Object.values(this.kcContext.profile.attributesByName).map(structuredCloneButFunctions);
|
|
127
|
-
})();
|
|
128
|
-
// Retro-compatibility and consistency patches
|
|
129
|
-
attributes.forEach(attribute => {
|
|
130
|
-
var _a, _b, _c;
|
|
131
|
-
patch_legacy_group: {
|
|
132
|
-
if (typeof attribute.group !== "string") {
|
|
133
|
-
break patch_legacy_group;
|
|
134
|
-
}
|
|
135
|
-
const { group, groupDisplayHeader, groupDisplayDescription, groupAnnotations } = attribute;
|
|
136
|
-
delete attribute.group;
|
|
137
|
-
// @ts-expect-error
|
|
138
|
-
delete attribute.groupDisplayHeader;
|
|
139
|
-
// @ts-expect-error
|
|
140
|
-
delete attribute.groupDisplayDescription;
|
|
141
|
-
// @ts-expect-error
|
|
142
|
-
delete attribute.groupAnnotations;
|
|
143
|
-
if (group === "") {
|
|
144
|
-
break patch_legacy_group;
|
|
145
|
-
}
|
|
146
|
-
attribute.group = {
|
|
147
|
-
name: group,
|
|
148
|
-
displayHeader: groupDisplayHeader,
|
|
149
|
-
displayDescription: groupDisplayDescription,
|
|
150
|
-
annotations: groupAnnotations,
|
|
151
|
-
html5DataAnnotations: {}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
// Attributes with options rendered by default as select inputs
|
|
155
|
-
if (attribute.validators.options !== undefined &&
|
|
156
|
-
attribute.annotations.inputType === undefined) {
|
|
157
|
-
attribute.annotations.inputType = "select";
|
|
158
|
-
}
|
|
159
|
-
// Consistency patch on values/value property
|
|
160
|
-
{
|
|
161
|
-
if (this.getIsMultivaluedSingleField({ attribute })) {
|
|
162
|
-
attribute.multivalued = true;
|
|
163
|
-
}
|
|
164
|
-
if (attribute.multivalued) {
|
|
165
|
-
(_a = attribute.values) !== null && _a !== void 0 ? _a : (attribute.values = attribute.value !== undefined ? [attribute.value] : []);
|
|
166
|
-
delete attribute.value;
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
(_b = attribute.value) !== null && _b !== void 0 ? _b : (attribute.value = (_c = attribute.values) === null || _c === void 0 ? void 0 : _c[0]);
|
|
170
|
-
delete attribute.values;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
add_password_and_password_confirm: {
|
|
175
|
-
if (!this.kcContext.passwordRequired) {
|
|
176
|
-
break add_password_and_password_confirm;
|
|
177
|
-
}
|
|
178
|
-
attributes.forEach((attribute, i) => {
|
|
179
|
-
if (attribute.name !==
|
|
180
|
-
(this.kcContext.realm.registrationEmailAsUsername
|
|
181
|
-
? "email"
|
|
182
|
-
: "username")) {
|
|
183
|
-
// NOTE: We want to add password and password-confirm after the field that identifies the user.
|
|
184
|
-
// It's either email or username.
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
attributes.splice(i + 1, 0, {
|
|
188
|
-
name: "password",
|
|
189
|
-
displayName: id("${password}"),
|
|
190
|
-
required: true,
|
|
191
|
-
readOnly: false,
|
|
192
|
-
validators: {},
|
|
193
|
-
annotations: {},
|
|
194
|
-
autocomplete: "new-password",
|
|
195
|
-
html5DataAnnotations: {}
|
|
196
|
-
}, {
|
|
197
|
-
name: "password-confirm",
|
|
198
|
-
displayName: id("${passwordConfirm}"),
|
|
199
|
-
required: true,
|
|
200
|
-
readOnly: false,
|
|
201
|
-
validators: {},
|
|
202
|
-
annotations: {},
|
|
203
|
-
html5DataAnnotations: {},
|
|
204
|
-
autocomplete: "new-password"
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
const initialFormFieldState = [];
|
|
209
|
-
for (const attribute of attributes) {
|
|
210
|
-
handle_multi_valued_attribute: {
|
|
211
|
-
if (!attribute.multivalued) {
|
|
212
|
-
break handle_multi_valued_attribute;
|
|
213
|
-
}
|
|
214
|
-
const values = ((_a = attribute.values) === null || _a === void 0 ? void 0 : _a.length) ? attribute.values : [""];
|
|
215
|
-
apply_validator_min_range: {
|
|
216
|
-
if (this.getIsMultivaluedSingleField({ attribute })) {
|
|
217
|
-
break apply_validator_min_range;
|
|
218
|
-
}
|
|
219
|
-
const validator = attribute.validators.multivalued;
|
|
220
|
-
if (validator === undefined) {
|
|
221
|
-
break apply_validator_min_range;
|
|
222
|
-
}
|
|
223
|
-
const { min: minStr } = validator;
|
|
224
|
-
if (!minStr) {
|
|
225
|
-
break apply_validator_min_range;
|
|
226
|
-
}
|
|
227
|
-
const min = parseInt(`${minStr}`);
|
|
228
|
-
for (let index = values.length; index < min; index++) {
|
|
229
|
-
values.push("");
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
initialFormFieldState.push({
|
|
233
|
-
attribute,
|
|
234
|
-
valueOrValues: values
|
|
235
|
-
});
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
initialFormFieldState.push({
|
|
239
|
-
attribute,
|
|
240
|
-
valueOrValues: (_b = attribute.value) !== null && _b !== void 0 ? _b : ""
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
const initialState = {
|
|
244
|
-
formFieldStates: initialFormFieldState.map(({ attribute, valueOrValues }) => ({
|
|
245
|
-
attribute,
|
|
246
|
-
errors: this.getErrors({
|
|
247
|
-
attributeName: attribute.name,
|
|
248
|
-
formFieldStates: initialFormFieldState
|
|
249
|
-
}),
|
|
250
|
-
hasLostFocusAtLeastOnce: valueOrValues instanceof Array &&
|
|
251
|
-
!this.getIsMultivaluedSingleField({ attribute })
|
|
252
|
-
? valueOrValues.map(() => false)
|
|
253
|
-
: false,
|
|
254
|
-
valueOrValues: valueOrValues
|
|
255
|
-
}))
|
|
256
|
-
};
|
|
257
|
-
return initialState;
|
|
258
|
-
})();
|
|
259
|
-
this.state = signal(this.initialState);
|
|
260
|
-
this.formState = computed(() => {
|
|
261
|
-
const state = this.state();
|
|
262
|
-
return {
|
|
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
|
-
let value = false;
|
|
272
|
-
switch (error.source.type) {
|
|
273
|
-
case "server":
|
|
274
|
-
value = true;
|
|
275
|
-
break;
|
|
276
|
-
case "other":
|
|
277
|
-
switch (error.source.rule) {
|
|
278
|
-
case "requiredField":
|
|
279
|
-
value = hasLostFocusAtLeastOnce;
|
|
280
|
-
break;
|
|
281
|
-
case "passwordConfirmMatchesPassword":
|
|
282
|
-
value = hasLostFocusAtLeastOnce;
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
// assert<Equals<typeof error.source.rule, never>>(false);
|
|
286
|
-
break;
|
|
287
|
-
case "passwordPolicy":
|
|
288
|
-
switch (error.source.name) {
|
|
289
|
-
case "length":
|
|
290
|
-
value = hasLostFocusAtLeastOnce;
|
|
291
|
-
break;
|
|
292
|
-
case "digits":
|
|
293
|
-
value = hasLostFocusAtLeastOnce;
|
|
294
|
-
break;
|
|
295
|
-
case "lowerCase":
|
|
296
|
-
value = hasLostFocusAtLeastOnce;
|
|
297
|
-
break;
|
|
298
|
-
case "upperCase":
|
|
299
|
-
value = hasLostFocusAtLeastOnce;
|
|
300
|
-
break;
|
|
301
|
-
case "specialChars":
|
|
302
|
-
value = hasLostFocusAtLeastOnce;
|
|
303
|
-
break;
|
|
304
|
-
case "notUsername":
|
|
305
|
-
value = true;
|
|
306
|
-
break;
|
|
307
|
-
case "notEmail":
|
|
308
|
-
value = true;
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
// assert<Equals<typeof error.source, never>>(false);
|
|
312
|
-
break;
|
|
313
|
-
case "validator":
|
|
314
|
-
switch (error.source.name) {
|
|
315
|
-
case "length":
|
|
316
|
-
value = hasLostFocusAtLeastOnce;
|
|
317
|
-
break;
|
|
318
|
-
case "pattern":
|
|
319
|
-
value = hasLostFocusAtLeastOnce;
|
|
320
|
-
break;
|
|
321
|
-
case "email":
|
|
322
|
-
value = hasLostFocusAtLeastOnce;
|
|
323
|
-
break;
|
|
324
|
-
case "integer":
|
|
325
|
-
value = hasLostFocusAtLeastOnce;
|
|
326
|
-
break;
|
|
327
|
-
case "multivalued":
|
|
328
|
-
value = hasLostFocusAtLeastOnce;
|
|
329
|
-
break;
|
|
330
|
-
case "options":
|
|
331
|
-
value = hasLostFocusAtLeastOnce;
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
// assert<Equals<typeof error.source, never>>(false);
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
return value;
|
|
338
|
-
}), attribute }, valueOrValuesWrap));
|
|
339
|
-
}),
|
|
340
|
-
isFormSubmittable: state.formFieldStates.every(({ errors }) => errors.length === 0)
|
|
341
|
-
};
|
|
342
|
-
});
|
|
343
|
-
this.loginResourceInjectorService.insertAdditionalScripts(Object.keys((_b = (_a = this.kcContext.profile) === null || _a === void 0 ? void 0 : _a.html5DataAnnotations) !== null && _b !== void 0 ? _b : {})
|
|
344
|
-
.filter(key => key !== "kcMultivalued" && key !== "kcNumberFormat") // NOTE: Keycloakify handles it.
|
|
345
|
-
.map(key => ({
|
|
346
|
-
type: "module",
|
|
347
|
-
src: `${this.kcContext.url.resourcesPath}/js/${key}.js`,
|
|
348
|
-
id: `${this.kcContext.url.resourcesPath}/js/${key}.js`
|
|
349
|
-
})));
|
|
350
|
-
}
|
|
351
|
-
dispatchFormAction(formAction) {
|
|
352
|
-
var _a;
|
|
353
|
-
if (!formAction)
|
|
354
|
-
return;
|
|
355
|
-
const state = this.state();
|
|
356
|
-
const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name === formAction.name);
|
|
357
|
-
assert(formFieldState !== undefined);
|
|
358
|
-
switch (formAction.action) {
|
|
359
|
-
case "update":
|
|
360
|
-
formFieldState.valueOrValues = formAction.valueOrValues;
|
|
361
|
-
apply_formatters: {
|
|
362
|
-
const { attribute } = formFieldState;
|
|
363
|
-
const { kcNumberFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
|
364
|
-
if (!kcNumberFormat) {
|
|
365
|
-
break apply_formatters;
|
|
366
|
-
}
|
|
367
|
-
if (formFieldState.valueOrValues instanceof Array) {
|
|
368
|
-
formFieldState.valueOrValues = formFieldState.valueOrValues.map(value => formatNumber(value, kcNumberFormat));
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
formFieldState.valueOrValues = formatNumber(formFieldState.valueOrValues, kcNumberFormat);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
formFieldState.errors = this.getErrors({
|
|
375
|
-
attributeName: formAction.name,
|
|
376
|
-
formFieldStates: state.formFieldStates
|
|
377
|
-
});
|
|
378
|
-
simulate_focus_lost: {
|
|
379
|
-
const { displayErrorsImmediately = false } = formAction;
|
|
380
|
-
if (!displayErrorsImmediately) {
|
|
381
|
-
break simulate_focus_lost;
|
|
382
|
-
}
|
|
383
|
-
for (const fieldIndex of formAction.valueOrValues instanceof Array
|
|
384
|
-
? formAction.valueOrValues.map((...[, index]) => index)
|
|
385
|
-
: [undefined]) {
|
|
386
|
-
this.dispatchFormAction({
|
|
387
|
-
action: "focus lost",
|
|
388
|
-
name: formAction.name,
|
|
389
|
-
fieldIndex
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
update_password_confirm: {
|
|
394
|
-
if (this.doMakeUserConfirmPassword) {
|
|
395
|
-
break update_password_confirm;
|
|
396
|
-
}
|
|
397
|
-
if (formAction.name !== "password") {
|
|
398
|
-
break update_password_confirm;
|
|
399
|
-
}
|
|
400
|
-
this.dispatchFormAction({
|
|
401
|
-
action: "update",
|
|
402
|
-
name: "password-confirm",
|
|
403
|
-
valueOrValues: formAction.valueOrValues,
|
|
404
|
-
displayErrorsImmediately: formAction.displayErrorsImmediately
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
trigger_password_confirm_validation_on_password_change: {
|
|
408
|
-
if (!this.doMakeUserConfirmPassword) {
|
|
409
|
-
break trigger_password_confirm_validation_on_password_change;
|
|
410
|
-
}
|
|
411
|
-
if (formAction.name !== "password") {
|
|
412
|
-
break trigger_password_confirm_validation_on_password_change;
|
|
413
|
-
}
|
|
414
|
-
this.dispatchFormAction({
|
|
415
|
-
action: "update",
|
|
416
|
-
name: "password-confirm",
|
|
417
|
-
valueOrValues: (() => {
|
|
418
|
-
const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name === "password-confirm");
|
|
419
|
-
assert(formFieldState !== undefined);
|
|
420
|
-
return formFieldState.valueOrValues;
|
|
421
|
-
})(),
|
|
422
|
-
displayErrorsImmediately: formAction.displayErrorsImmediately
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
break;
|
|
426
|
-
case "focus lost":
|
|
427
|
-
if (formFieldState.hasLostFocusAtLeastOnce instanceof Array) {
|
|
428
|
-
const { fieldIndex } = formAction;
|
|
429
|
-
assert(fieldIndex !== undefined);
|
|
430
|
-
formFieldState.hasLostFocusAtLeastOnce[fieldIndex] = true;
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
formFieldState.hasLostFocusAtLeastOnce = true;
|
|
434
|
-
break;
|
|
435
|
-
}
|
|
436
|
-
this.state.update(state => (Object.assign(Object.assign({}, state), { formFieldStates: state.formFieldStates.map(f => {
|
|
437
|
-
if (f.attribute === formFieldState.attribute)
|
|
438
|
-
return formFieldState;
|
|
439
|
-
return f;
|
|
440
|
-
}) })));
|
|
441
|
-
}
|
|
442
|
-
getIsMultivaluedSingleField(params) {
|
|
443
|
-
var _a, _b;
|
|
444
|
-
const { attribute } = params;
|
|
445
|
-
return (_b = (_a = attribute.annotations.inputType) === null || _a === void 0 ? void 0 : _a.startsWith("multiselect")) !== null && _b !== void 0 ? _b : false;
|
|
446
|
-
}
|
|
447
|
-
getErrors(params) {
|
|
448
|
-
var _a, _b;
|
|
449
|
-
const { messagesPerField, passwordPolicies } = this.kcContext;
|
|
450
|
-
const { msgStr, advancedMsgStr } = this.i18n;
|
|
451
|
-
const { attributeName, formFieldStates } = params;
|
|
452
|
-
const formFieldState = formFieldStates.find(({ attribute }) => attribute.name === attributeName);
|
|
453
|
-
assert(formFieldState !== undefined);
|
|
454
|
-
const { attribute } = formFieldState;
|
|
455
|
-
const valueOrValues = (() => {
|
|
456
|
-
var _a;
|
|
457
|
-
let { valueOrValues } = formFieldState;
|
|
458
|
-
unFormat_number: {
|
|
459
|
-
const { kcNumberUnFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
|
460
|
-
if (!kcNumberUnFormat) {
|
|
461
|
-
break unFormat_number;
|
|
462
|
-
}
|
|
463
|
-
if (valueOrValues instanceof Array) {
|
|
464
|
-
valueOrValues = valueOrValues.map(value => formatNumber(value, kcNumberUnFormat));
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
467
|
-
valueOrValues = formatNumber(valueOrValues, kcNumberUnFormat);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
return valueOrValues;
|
|
471
|
-
})();
|
|
472
|
-
assert(attribute !== undefined);
|
|
473
|
-
server_side_error: {
|
|
474
|
-
if (attribute.multivalued) {
|
|
475
|
-
const defaultValues = ((_a = attribute.values) === null || _a === void 0 ? void 0 : _a.length) ? attribute.values : [""];
|
|
476
|
-
assert(valueOrValues instanceof Array);
|
|
477
|
-
const values = valueOrValues;
|
|
478
|
-
if (JSON.stringify(defaultValues) !==
|
|
479
|
-
JSON.stringify(values.slice(0, defaultValues.length))) {
|
|
480
|
-
break server_side_error;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
const defaultValue = (_b = attribute.value) !== null && _b !== void 0 ? _b : "";
|
|
485
|
-
assert(typeof valueOrValues === "string");
|
|
486
|
-
const value = valueOrValues;
|
|
487
|
-
if (defaultValue !== value) {
|
|
488
|
-
break server_side_error;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
let doesErrorExist;
|
|
492
|
-
try {
|
|
493
|
-
doesErrorExist = messagesPerField.existsError(attributeName);
|
|
494
|
-
}
|
|
495
|
-
catch (_c) {
|
|
496
|
-
break server_side_error;
|
|
497
|
-
}
|
|
498
|
-
if (!doesErrorExist) {
|
|
499
|
-
break server_side_error;
|
|
500
|
-
}
|
|
501
|
-
const errorMessageStr = messagesPerField.get(attributeName);
|
|
502
|
-
return [
|
|
503
|
-
{
|
|
504
|
-
errorMessageStr,
|
|
505
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span>${errorMessageStr}</span>`),
|
|
506
|
-
fieldIndex: undefined,
|
|
507
|
-
source: {
|
|
508
|
-
type: "server"
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
];
|
|
512
|
-
}
|
|
513
|
-
handle_multi_valued_multi_fields: {
|
|
514
|
-
if (!attribute.multivalued) {
|
|
515
|
-
break handle_multi_valued_multi_fields;
|
|
516
|
-
}
|
|
517
|
-
if (this.getIsMultivaluedSingleField({ attribute })) {
|
|
518
|
-
break handle_multi_valued_multi_fields;
|
|
519
|
-
}
|
|
520
|
-
assert(valueOrValues instanceof Array);
|
|
521
|
-
const values = valueOrValues;
|
|
522
|
-
const errors = values
|
|
523
|
-
.map((...[, index]) => {
|
|
524
|
-
const specificValueErrors = this.getErrors({
|
|
525
|
-
attributeName,
|
|
526
|
-
formFieldStates: formFieldStates.map(formFieldState => {
|
|
527
|
-
if (formFieldState.attribute.name === attributeName) {
|
|
528
|
-
assert(formFieldState.valueOrValues instanceof Array);
|
|
529
|
-
return {
|
|
530
|
-
attribute: Object.assign(Object.assign({}, attribute), { annotations: Object.assign(Object.assign({}, attribute.annotations), { inputType: undefined }), multivalued: false }),
|
|
531
|
-
valueOrValues: formFieldState.valueOrValues[index]
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
return formFieldState;
|
|
535
|
-
})
|
|
536
|
-
});
|
|
537
|
-
return specificValueErrors
|
|
538
|
-
.filter(error => {
|
|
539
|
-
if (error.source.type === "other" &&
|
|
540
|
-
error.source.rule === "requiredField") {
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
return true;
|
|
544
|
-
})
|
|
545
|
-
.map((error) => (Object.assign(Object.assign({}, error), { fieldIndex: index })));
|
|
546
|
-
})
|
|
547
|
-
.reduce((acc, errors) => [...acc, ...errors], []);
|
|
548
|
-
required_field: {
|
|
549
|
-
if (!attribute.required) {
|
|
550
|
-
break required_field;
|
|
551
|
-
}
|
|
552
|
-
if (values.every(value => value !== "")) {
|
|
553
|
-
break required_field;
|
|
554
|
-
}
|
|
555
|
-
const msgArgs = ["error-user-attribute-required"];
|
|
556
|
-
errors.push({
|
|
557
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
558
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
559
|
-
fieldIndex: undefined,
|
|
560
|
-
source: {
|
|
561
|
-
type: "other",
|
|
562
|
-
rule: "requiredField"
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
return errors;
|
|
567
|
-
}
|
|
568
|
-
handle_multi_valued_single_field: {
|
|
569
|
-
if (!attribute.multivalued) {
|
|
570
|
-
break handle_multi_valued_single_field;
|
|
571
|
-
}
|
|
572
|
-
if (!this.getIsMultivaluedSingleField({ attribute })) {
|
|
573
|
-
break handle_multi_valued_single_field;
|
|
574
|
-
}
|
|
575
|
-
const validatorName = "multivalued";
|
|
576
|
-
const validator = attribute.validators[validatorName];
|
|
577
|
-
if (validator === undefined) {
|
|
578
|
-
return [];
|
|
579
|
-
}
|
|
580
|
-
const { min: minStr } = validator;
|
|
581
|
-
const min = minStr ? parseInt(`${minStr}`) : attribute.required ? 1 : 0;
|
|
582
|
-
assert(!isNaN(min));
|
|
583
|
-
const { max: maxStr } = validator;
|
|
584
|
-
const max = !maxStr ? Infinity : parseInt(`${maxStr}`);
|
|
585
|
-
assert(!isNaN(max));
|
|
586
|
-
assert(valueOrValues instanceof Array);
|
|
587
|
-
const values = valueOrValues;
|
|
588
|
-
if (min <= values.length && values.length <= max) {
|
|
589
|
-
return [];
|
|
590
|
-
}
|
|
591
|
-
const msgArgs = [
|
|
592
|
-
"error-invalid-multivalued-size",
|
|
593
|
-
`${min}`,
|
|
594
|
-
`${max}`
|
|
595
|
-
];
|
|
596
|
-
return [
|
|
597
|
-
{
|
|
598
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="0">${msgStr(...msgArgs)}</span>`),
|
|
599
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
600
|
-
fieldIndex: undefined,
|
|
601
|
-
source: {
|
|
602
|
-
type: "validator",
|
|
603
|
-
name: validatorName
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
];
|
|
607
|
-
}
|
|
608
|
-
assert(typeof valueOrValues === "string");
|
|
609
|
-
const value = valueOrValues;
|
|
610
|
-
const errors = [];
|
|
611
|
-
check_password_policies: {
|
|
612
|
-
if (attributeName !== "password") {
|
|
613
|
-
break check_password_policies;
|
|
614
|
-
}
|
|
615
|
-
if (passwordPolicies === undefined) {
|
|
616
|
-
break check_password_policies;
|
|
617
|
-
}
|
|
618
|
-
check_password_policy_x: {
|
|
619
|
-
const policyName = "length";
|
|
620
|
-
const policy = passwordPolicies[policyName];
|
|
621
|
-
if (!policy) {
|
|
622
|
-
break check_password_policy_x;
|
|
623
|
-
}
|
|
624
|
-
const minLength = policy;
|
|
625
|
-
if (value.length >= minLength) {
|
|
626
|
-
break check_password_policy_x;
|
|
627
|
-
}
|
|
628
|
-
const msgArgs = [
|
|
629
|
-
"invalidPasswordMinLengthMessage",
|
|
630
|
-
`${minLength}`
|
|
631
|
-
];
|
|
632
|
-
errors.push({
|
|
633
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
634
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
635
|
-
fieldIndex: undefined,
|
|
636
|
-
source: {
|
|
637
|
-
type: "passwordPolicy",
|
|
638
|
-
name: policyName
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
check_password_policy_x: {
|
|
643
|
-
const policyName = "digits";
|
|
644
|
-
const policy = passwordPolicies[policyName];
|
|
645
|
-
if (!policy) {
|
|
646
|
-
break check_password_policy_x;
|
|
647
|
-
}
|
|
648
|
-
const minNumberOfDigits = policy;
|
|
649
|
-
if (value.split("").filter(char => !isNaN(parseInt(char))).length >=
|
|
650
|
-
minNumberOfDigits) {
|
|
651
|
-
break check_password_policy_x;
|
|
652
|
-
}
|
|
653
|
-
const msgArgs = [
|
|
654
|
-
"invalidPasswordMinDigitsMessage",
|
|
655
|
-
`${minNumberOfDigits}`
|
|
656
|
-
];
|
|
657
|
-
errors.push({
|
|
658
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
659
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
660
|
-
fieldIndex: undefined,
|
|
661
|
-
source: {
|
|
662
|
-
type: "passwordPolicy",
|
|
663
|
-
name: policyName
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
}
|
|
667
|
-
check_password_policy_x: {
|
|
668
|
-
const policyName = "lowerCase";
|
|
669
|
-
const policy = passwordPolicies[policyName];
|
|
670
|
-
if (!policy) {
|
|
671
|
-
break check_password_policy_x;
|
|
672
|
-
}
|
|
673
|
-
const minNumberOfLowerCaseChar = policy;
|
|
674
|
-
if (value
|
|
675
|
-
.split("")
|
|
676
|
-
.filter(char => char === char.toLowerCase() && char !== char.toUpperCase()).length >= minNumberOfLowerCaseChar) {
|
|
677
|
-
break check_password_policy_x;
|
|
678
|
-
}
|
|
679
|
-
const msgArgs = [
|
|
680
|
-
"invalidPasswordMinLowerCaseCharsMessage",
|
|
681
|
-
`${minNumberOfLowerCaseChar}`
|
|
682
|
-
];
|
|
683
|
-
errors.push({
|
|
684
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
685
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
686
|
-
fieldIndex: undefined,
|
|
687
|
-
source: {
|
|
688
|
-
type: "passwordPolicy",
|
|
689
|
-
name: policyName
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
check_password_policy_x: {
|
|
694
|
-
const policyName = "upperCase";
|
|
695
|
-
const policy = passwordPolicies[policyName];
|
|
696
|
-
if (!policy) {
|
|
697
|
-
break check_password_policy_x;
|
|
698
|
-
}
|
|
699
|
-
const minNumberOfUpperCaseChar = policy;
|
|
700
|
-
if (value
|
|
701
|
-
.split("")
|
|
702
|
-
.filter(char => char === char.toUpperCase() && char !== char.toLowerCase()).length >= minNumberOfUpperCaseChar) {
|
|
703
|
-
break check_password_policy_x;
|
|
704
|
-
}
|
|
705
|
-
const msgArgs = [
|
|
706
|
-
"invalidPasswordMinUpperCaseCharsMessage",
|
|
707
|
-
`${minNumberOfUpperCaseChar}`
|
|
708
|
-
];
|
|
709
|
-
errors.push({
|
|
710
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
711
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
712
|
-
fieldIndex: undefined,
|
|
713
|
-
source: {
|
|
714
|
-
type: "passwordPolicy",
|
|
715
|
-
name: policyName
|
|
716
|
-
}
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
check_password_policy_x: {
|
|
720
|
-
const policyName = "specialChars";
|
|
721
|
-
const policy = passwordPolicies[policyName];
|
|
722
|
-
if (!policy) {
|
|
723
|
-
break check_password_policy_x;
|
|
724
|
-
}
|
|
725
|
-
const minNumberOfSpecialChar = policy;
|
|
726
|
-
if (value.split("").filter(char => !char.match(/[a-zA-Z0-9]/)).length >=
|
|
727
|
-
minNumberOfSpecialChar) {
|
|
728
|
-
break check_password_policy_x;
|
|
729
|
-
}
|
|
730
|
-
const msgArgs = [
|
|
731
|
-
"invalidPasswordMinSpecialCharsMessage",
|
|
732
|
-
`${minNumberOfSpecialChar}`
|
|
733
|
-
];
|
|
734
|
-
errors.push({
|
|
735
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
736
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
737
|
-
fieldIndex: undefined,
|
|
738
|
-
source: {
|
|
739
|
-
type: "passwordPolicy",
|
|
740
|
-
name: policyName
|
|
741
|
-
}
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
check_password_policy_x: {
|
|
745
|
-
const policyName = "notUsername";
|
|
746
|
-
const notUsername = passwordPolicies[policyName];
|
|
747
|
-
if (!notUsername) {
|
|
748
|
-
break check_password_policy_x;
|
|
749
|
-
}
|
|
750
|
-
const usernameFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "username");
|
|
751
|
-
if (!usernameFormFieldState) {
|
|
752
|
-
break check_password_policy_x;
|
|
753
|
-
}
|
|
754
|
-
const usernameValue = (() => {
|
|
755
|
-
var _a;
|
|
756
|
-
let { valueOrValues } = usernameFormFieldState;
|
|
757
|
-
assert(typeof valueOrValues === "string");
|
|
758
|
-
unFormat_number: {
|
|
759
|
-
const { kcNumberUnFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
|
760
|
-
if (!kcNumberUnFormat) {
|
|
761
|
-
break unFormat_number;
|
|
762
|
-
}
|
|
763
|
-
valueOrValues = formatNumber(valueOrValues, kcNumberUnFormat);
|
|
764
|
-
}
|
|
765
|
-
return valueOrValues;
|
|
766
|
-
})();
|
|
767
|
-
if (usernameValue === "") {
|
|
768
|
-
break check_password_policy_x;
|
|
769
|
-
}
|
|
770
|
-
if (value !== usernameValue) {
|
|
771
|
-
break check_password_policy_x;
|
|
772
|
-
}
|
|
773
|
-
const msgArgs = ["invalidPasswordNotUsernameMessage"];
|
|
774
|
-
errors.push({
|
|
775
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
776
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
777
|
-
fieldIndex: undefined,
|
|
778
|
-
source: {
|
|
779
|
-
type: "passwordPolicy",
|
|
780
|
-
name: policyName
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
check_password_policy_x: {
|
|
785
|
-
const policyName = "notEmail";
|
|
786
|
-
const notEmail = passwordPolicies[policyName];
|
|
787
|
-
if (!notEmail) {
|
|
788
|
-
break check_password_policy_x;
|
|
789
|
-
}
|
|
790
|
-
const emailFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "email");
|
|
791
|
-
if (!emailFormFieldState) {
|
|
792
|
-
break check_password_policy_x;
|
|
793
|
-
}
|
|
794
|
-
assert(typeof emailFormFieldState.valueOrValues === "string");
|
|
795
|
-
{
|
|
796
|
-
const emailValue = emailFormFieldState.valueOrValues;
|
|
797
|
-
if (emailValue === "") {
|
|
798
|
-
break check_password_policy_x;
|
|
799
|
-
}
|
|
800
|
-
if (value !== emailValue) {
|
|
801
|
-
break check_password_policy_x;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
const msgArgs = ["invalidPasswordNotEmailMessage"];
|
|
805
|
-
errors.push({
|
|
806
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
807
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
808
|
-
fieldIndex: undefined,
|
|
809
|
-
source: {
|
|
810
|
-
type: "passwordPolicy",
|
|
811
|
-
name: policyName
|
|
812
|
-
}
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
password_confirm_matches_password: {
|
|
817
|
-
if (attributeName !== "password-confirm") {
|
|
818
|
-
break password_confirm_matches_password;
|
|
819
|
-
}
|
|
820
|
-
const passwordFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "password");
|
|
821
|
-
assert(passwordFormFieldState !== undefined);
|
|
822
|
-
assert(typeof passwordFormFieldState.valueOrValues === "string");
|
|
823
|
-
{
|
|
824
|
-
const passwordValue = passwordFormFieldState.valueOrValues;
|
|
825
|
-
if (value === passwordValue) {
|
|
826
|
-
break password_confirm_matches_password;
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
const msgArgs = ["invalidPasswordConfirmMessage"];
|
|
830
|
-
errors.push({
|
|
831
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
832
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
833
|
-
fieldIndex: undefined,
|
|
834
|
-
source: {
|
|
835
|
-
type: "other",
|
|
836
|
-
rule: "passwordConfirmMatchesPassword"
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
const { validators } = attribute;
|
|
841
|
-
required_field: {
|
|
842
|
-
if (!attribute.required) {
|
|
843
|
-
break required_field;
|
|
844
|
-
}
|
|
845
|
-
if (value !== "") {
|
|
846
|
-
break required_field;
|
|
847
|
-
}
|
|
848
|
-
const msgArgs = ["error-user-attribute-required"];
|
|
849
|
-
errors.push({
|
|
850
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
851
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
852
|
-
fieldIndex: undefined,
|
|
853
|
-
source: {
|
|
854
|
-
type: "other",
|
|
855
|
-
rule: "requiredField"
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
|
-
}
|
|
859
|
-
validator_x: {
|
|
860
|
-
const validatorName = "length";
|
|
861
|
-
const validator = validators[validatorName];
|
|
862
|
-
if (!validator) {
|
|
863
|
-
break validator_x;
|
|
864
|
-
}
|
|
865
|
-
const { "ignore.empty.value": ignoreEmptyValue = false, max, min } = validator;
|
|
866
|
-
if (ignoreEmptyValue && value === "") {
|
|
867
|
-
break validator_x;
|
|
868
|
-
}
|
|
869
|
-
const source = {
|
|
870
|
-
type: "validator",
|
|
871
|
-
name: validatorName
|
|
872
|
-
};
|
|
873
|
-
if (max && value.length > parseInt(`${max}`)) {
|
|
874
|
-
const msgArgs = ["error-invalid-length-too-long", `${max}`];
|
|
875
|
-
errors.push({
|
|
876
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
877
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
878
|
-
fieldIndex: undefined,
|
|
879
|
-
source
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
if (min && value.length < parseInt(`${min}`)) {
|
|
883
|
-
const msgArgs = ["error-invalid-length-too-short", `${min}`];
|
|
884
|
-
errors.push({
|
|
885
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
886
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
887
|
-
fieldIndex: undefined,
|
|
888
|
-
source
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
validator_x: {
|
|
893
|
-
const validatorName = "pattern";
|
|
894
|
-
const validator = validators[validatorName];
|
|
895
|
-
if (validator === undefined) {
|
|
896
|
-
break validator_x;
|
|
897
|
-
}
|
|
898
|
-
const { "ignore.empty.value": ignoreEmptyValue = false, pattern, "error-message": errorMessageKey } = validator;
|
|
899
|
-
if (ignoreEmptyValue && value === "") {
|
|
900
|
-
break validator_x;
|
|
901
|
-
}
|
|
902
|
-
if (new RegExp(pattern).test(value)) {
|
|
903
|
-
break validator_x;
|
|
904
|
-
}
|
|
905
|
-
const msgArgs = [
|
|
906
|
-
errorMessageKey !== null && errorMessageKey !== void 0 ? errorMessageKey : id("shouldMatchPattern"),
|
|
907
|
-
pattern
|
|
908
|
-
];
|
|
909
|
-
errors.push({
|
|
910
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${advancedMsgStr(...msgArgs)}</span>`),
|
|
911
|
-
errorMessageStr: advancedMsgStr(...msgArgs),
|
|
912
|
-
fieldIndex: undefined,
|
|
913
|
-
source: {
|
|
914
|
-
type: "validator",
|
|
915
|
-
name: validatorName
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
validator_x: {
|
|
920
|
-
{
|
|
921
|
-
const lastError = errors[errors.length - 1];
|
|
922
|
-
if (lastError !== undefined &&
|
|
923
|
-
lastError.source.type === "validator" &&
|
|
924
|
-
lastError.source.name === "pattern") {
|
|
925
|
-
break validator_x;
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
const validatorName = "email";
|
|
929
|
-
const validator = validators[validatorName];
|
|
930
|
-
if (validator === undefined) {
|
|
931
|
-
break validator_x;
|
|
932
|
-
}
|
|
933
|
-
const { "ignore.empty.value": ignoreEmptyValue = false } = validator;
|
|
934
|
-
if (ignoreEmptyValue && value === "") {
|
|
935
|
-
break validator_x;
|
|
936
|
-
}
|
|
937
|
-
if (emailRegexp.test(value)) {
|
|
938
|
-
break validator_x;
|
|
939
|
-
}
|
|
940
|
-
const msgArgs = [id("invalidEmailMessage")];
|
|
941
|
-
errors.push({
|
|
942
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
943
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
944
|
-
fieldIndex: undefined,
|
|
945
|
-
source: {
|
|
946
|
-
type: "validator",
|
|
947
|
-
name: validatorName
|
|
948
|
-
}
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
validator_x: {
|
|
952
|
-
const validatorName = "integer";
|
|
953
|
-
const validator = validators[validatorName];
|
|
954
|
-
if (validator === undefined) {
|
|
955
|
-
break validator_x;
|
|
956
|
-
}
|
|
957
|
-
const { "ignore.empty.value": ignoreEmptyValue = false, max, min } = validator;
|
|
958
|
-
if (ignoreEmptyValue && value === "") {
|
|
959
|
-
break validator_x;
|
|
960
|
-
}
|
|
961
|
-
const intValue = parseInt(value);
|
|
962
|
-
const source = {
|
|
963
|
-
type: "validator",
|
|
964
|
-
name: validatorName
|
|
965
|
-
};
|
|
966
|
-
if (isNaN(intValue)) {
|
|
967
|
-
const msgArgs = ["mustBeAnInteger"];
|
|
968
|
-
errors.push({
|
|
969
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
970
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
971
|
-
fieldIndex: undefined,
|
|
972
|
-
source
|
|
973
|
-
});
|
|
974
|
-
break validator_x;
|
|
975
|
-
}
|
|
976
|
-
if (max && intValue > parseInt(`${max}`)) {
|
|
977
|
-
const msgArgs = ["error-number-out-of-range-too-big", `${max}`];
|
|
978
|
-
errors.push({
|
|
979
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
980
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
981
|
-
fieldIndex: undefined,
|
|
982
|
-
source
|
|
983
|
-
});
|
|
984
|
-
break validator_x;
|
|
985
|
-
}
|
|
986
|
-
if (min && intValue < parseInt(`${min}`)) {
|
|
987
|
-
const msgArgs = [
|
|
988
|
-
"error-number-out-of-range-too-small",
|
|
989
|
-
`${min}`
|
|
990
|
-
];
|
|
991
|
-
errors.push({
|
|
992
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
993
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
994
|
-
fieldIndex: undefined,
|
|
995
|
-
source
|
|
996
|
-
});
|
|
997
|
-
break validator_x;
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
validator_x: {
|
|
1001
|
-
const validatorName = "options";
|
|
1002
|
-
const validator = validators[validatorName];
|
|
1003
|
-
if (validator === undefined) {
|
|
1004
|
-
break validator_x;
|
|
1005
|
-
}
|
|
1006
|
-
if (value === "") {
|
|
1007
|
-
break validator_x;
|
|
1008
|
-
}
|
|
1009
|
-
if (validator.options.indexOf(value) >= 0) {
|
|
1010
|
-
break validator_x;
|
|
1011
|
-
}
|
|
1012
|
-
const msgArgs = [id("notAValidOption")];
|
|
1013
|
-
errors.push({
|
|
1014
|
-
errorMessage: this.sanitizer.bypassSecurityTrustHtml(`<span data-key="${attributeName}-${errors.length}">${msgStr(...msgArgs)}</span>`),
|
|
1015
|
-
errorMessageStr: msgStr(...msgArgs),
|
|
1016
|
-
fieldIndex: undefined,
|
|
1017
|
-
source: {
|
|
1018
|
-
type: "validator",
|
|
1019
|
-
name: validatorName
|
|
1020
|
-
}
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
|
-
//TODO: Implement missing validators. See Validators type definition.
|
|
1024
|
-
return errors;
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
UserProfileFormService = __decorate([
|
|
1028
|
-
Injectable({ providedIn: "root" })
|
|
1029
|
-
], UserProfileFormService);
|
|
1030
|
-
export { UserProfileFormService };
|
|
1031
|
-
//# sourceMappingURL=user-profile-form.service.js.map
|