Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloak Add user's name in email theme template

I am creating an email theme for keycloak. So, when a user forgets their password and requests for a link to reset it; an email is sent to the user.

Now, I am cutomizing the email that he/she gets. I want to add the user's name. Can I do that?

I do have access to variables including: link to reset password link expiration time realm name

How do I get the user's name so that the email template says

Hello John,

blah blah blah

like image 578
Cute_Ninja Avatar asked May 12 '16 23:05

Cute_Ninja


1 Answers

You can add user.username in your .ftl file

open (email/text) *.ftl file and add user.username as one of the parameter like

${msg("passwordResetBody",link, linkExpiration, realmName,user.username)}

and then update actual message body at (email/messages/messages_en.properties) with parameter number like {2} or {3} (in this case it is {3} )

like image 135
meetarun Avatar answered Oct 28 '22 08:10

meetarun