Good! Does anyone know how I can add a field to confirm email, the same as to confirm password and to verify if what is entered is equal to the email field.
Take a look at the example in https://github.com/zonaut/keycloak-extensions/tree/master/spi-registration-profile which changes/removes some fields and it also shows some code on how these are handled. It should be enough for this use case.
Yes @hugoohd97 it’s possible. I assume you are trying to add it in register.ftl
What you need to do is that you have to add another field similar to email.
The original register.ftl
is :
<div class="${properties.kcLabelWrapperClass!}">
<label for="email" class="${properties.kcLabelClass!} ${properties.kcLabelMandatory}">${msg("email")}</label>
</div>
<div class="${properties.kcInputWrapperClass!}">
<input type="text" id="email" class="${properties.kcInputClass!}" name="email" value="${(register.formData.email!'')}" autocomplete="email" oncopy="return false" onpaste="return false" oncut="return false" onkeyup="emailValidate(this)" onchange="emailValidateChange(this)"/>
</div>
</div>
I added the confirm email field which I have named as email OK
like below
<div class="${properties.kcLabelWrapperClass!}">
<label for="emailOk" class="${properties.kcLabelClass!} ${properties.kcLabelMandatory}">${msg("confirmEmail")}</label>
</div>
<div class="${properties.kcInputWrapperClass!}">
<input type="text" id="emailOk" class="${properties.kcInputClass!}" name="emailOk" value="${(register.formData.emailOk!'')}" autocomplete="email" oncopy="return false" onpaste="return false" oncut="return false" onkeyup="emailValidationConfirm(this)"/>
</div>
</div>
On top of the file you can add your own script and with the help of javascript validate email and confirm email fields. I am validating on keyup
.
Hope this helps.