Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty error message when validation issue due the PersonNameProhibitedValidator validation #26750

Closed
1 task done
mposolda opened this issue Feb 2, 2024 · 0 comments · Fixed by #26751
Closed
1 task done
Assignees
Milestone

Comments

@mposolda
Copy link
Contributor

mposolda commented Feb 2, 2024

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

user-profile

Describe the bug

  • Edit some attribute in admin console in user-profile and go to section Validations

  • Try to add validator person-name-prohibited-characters

  • There is configuration option Error message key, which has this tooltip Key of the error message in i18n bundle. Dafault message key is error-person-name-invalid-character . This implies to me that I can just leave this empty to have the default name.

  • Issue 1: There is minor typo in the tooltip (Dafault)

  • I save the validator. In the JSON, it is saved with empty error-message option.

    {
      "name": "my-attribute",
      "displayName": "",
      "validations": {
        "person-name-prohibited-characters": {
          "error-message": ""
        }
      },
  • Issue 2: Now I try to edit some user and I fill my-attribute with incorrect value like Jo&hn . There is only error message my-attribute without any further explanation of what was wrong. Reason is, that default error message was not applied, but instead, it used empty error message. See screenshot

Screenshot from 2024-02-02 17-29-50

NOTE: Same issue happens also for some other validators (like PatternValidator or UsernameProhibitedCharactersValidator)

Version

nightly

Expected behavior

Some more appropriate error message like my attribute has invalid characters instead of just my attribute without any explanation. Basically when "error message" parameter is not null, but blank, it can be still good to fallback to default error message.

Actual behavior

Error message my-attribute without any explanation (See screenshot)

How to Reproduce?

See above

Anything else?

Not sure if this can be improved also in the UI layer and when attempting to save validator with some empty configuration parameter, it is considered that this configuration parameter was not used at all (rather than adding this parameter with empty value). So in my case, it can just save validator without error-message parameter like:

      "validations": {
        "person-name-prohibited-characters": {}
      },

instead of:

      "validations": {
        "person-name-prohibited-characters": {
          "error-message": ""
        }
      },

This would need to be fixed in UI layer though...

@mposolda mposolda added kind/bug Categorizes a PR related to a bug status/triage labels Feb 2, 2024
@mposolda mposolda self-assigned this Feb 2, 2024
@mposolda mposolda added this to the 24.0.0 milestone Feb 2, 2024
mposolda added a commit to mposolda/keycloak that referenced this issue Feb 2, 2024
…dValidator validation

closes keycloak#26750

Signed-off-by: mposolda <mposolda@gmail.com>
pedroigor pushed a commit that referenced this issue Feb 6, 2024
…dValidator validation

closes #26750

Signed-off-by: mposolda <mposolda@gmail.com>
cavuugroup pushed a commit to cavuugroup/keycloak that referenced this issue Feb 8, 2024
…dValidator validation

closes keycloak#26750

Signed-off-by: mposolda <mposolda@gmail.com>
Signed-off-by: Krzysztof Walczewski <kwalczewski@gmail.com>
ahus1 pushed a commit to ahus1/keycloak that referenced this issue Mar 22, 2024
…dValidator validation

closes keycloak#26750

Signed-off-by: mposolda <mposolda@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant