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

User profile validation pattern error-message not rendered from messages_en.properties #29098

Closed
1 of 2 tasks
DaBonse opened this issue Apr 26, 2024 · 3 comments · Fixed by #30654
Closed
1 of 2 tasks

Comments

@DaBonse
Copy link

DaBonse commented Apr 26, 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

admin/ui

Describe the bug

I use translation placeholder to configure messages for the user profile attributes. This worked as expected.

The translations located in the propertie file of the admin theme.

But the error-message for the pattern validator will not be rendered. Other placeholder translations like annotations work fine in the same properties file, e.g. profile.attribute.myAttribute.placeholder and profile.attribute.myAttribute.description.

I tested it with "Add User" in the Admin UI keycloak.v2 theme.

Part of json config of the user profile:

{ "name": "myAttribute", "displayName": "${profile.attribute.myAttribute}", "validations": { "pattern": { "pattern": "^(admin|abc[0-9]{9,9})$", "error-message": "${profile.attribute.myAttribute.validator.errorMessage}" } }, "annotations": { "inputTypePlaceholder": "${profile.attribute.myAttribute.placeholder}", "inputHelperTextBefore": "${profile.attribute.myAttribute.description}" }, "required": { "roles": [ "admin", "user" ] }

Content in: admin/messages/messages_en.properties

profile.attribute.myAttribute.validator.errorMessage=My error message

Version

nightly Docker build

Regression

  • The issue is a regression

Expected behavior

Validator message should be rendered like other placeholders.

Actual behavior

see description on top

How to Reproduce?

  • create a new realm
  • configure user attribute like my example
  • expand keycloak.v2 admin theme only with the admin/messages/messages_en.properties file
  • activate the custom theme
  • create a new user over Admin UI in the realm and put a invalid value to the attribute form field

Anything else?

No response

@keycloak-github-bot
Copy link

Due to the amount of issues reported by the community we are not able to prioritise resolving this issue at the moment.

If you are affected by this issue, upvote it by adding a 👍 to the description. We would also welcome a contribution to fix the issue.

@edewit
Copy link
Contributor

edewit commented Jun 21, 2024

fixed it and btw you can use the regex in your message like this:

profile.attribute.myAttribute.validator.errorMessage=My error message it must adhere to regex: {{1}}

@edewit edewit self-assigned this Jun 21, 2024
edewit added a commit to edewit/keycloak that referenced this issue Jun 21, 2024
fixes: keycloak#29098
Signed-off-by: Erik Jan de Wit <[email protected]>
@DaBonse
Copy link
Author

DaBonse commented Jul 1, 2024

In Version 25.0.1 it still not working. The nightly build is not testable at this time, because user profile ui is broken.

I am waiting for merging and will test it again.

ssilvert pushed a commit to edewit/keycloak that referenced this issue Jul 2, 2024
fixes: keycloak#29098
Signed-off-by: Erik Jan de Wit <[email protected]>
edewit added a commit that referenced this issue Jul 2, 2024
fixes: #29098

Signed-off-by: Erik Jan de Wit <[email protected]>
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.

3 participants