Reputation: 3697
I would like to register users only using email and password.
Removing fields from register.ftl, will remove them from the UI, but the server will still validate them.
This question is very similar: Keycloak Remove First Name and Last Name fields on Registration Screen
Problem is I could not find these validation check in the newer version of Keycloak, I am using v 4.8.1.
Best solution would be to remove them entirely and keep validation for the other fields, but disabling the form validation and using custom one also works for me.
Thank you in advance
Upvotes: 4
Views: 4278
Reputation: 3697
Here is what I did as workaround for keycloak v4.8.3.
There is no option to disable form registration form validation anymore, so you have two options
Got to keycloak-4.8.1.Final/themes/base/login, find register.ftl and add default value to first and last name, then add style display none to them so they won't show. Like so:
<div class="${properties.kcFormGroupClass!} ${messagesPerField.printIfExists('firstName',properties.kcFormGroupErrorClass!)}" style="display:none">
<div class="${properties.kcLabelWrapperClass!}">
<label for="firstName" class="${properties.kcLabelClass!}">${msg("firstName")}</label>
</div>
<div class="${properties.kcInputWrapperClass!}">
<input type="text" id="firstName" class="${properties.kcInputClass!}" name="firstName" value="temp_first_name"/>
</div>
</div>
Hope it was helpful.
Upvotes: 4