Hi Dmitry,
Thanks for your reply! I ended up implementing my own EventListenerProvider /
Theme-Extension, like you mentioned.
Unfortunately a few things with this solution are not ideal:
1) The EventListenerProviderFactory-Interface resides in a "private" module,
assuming meaning the SPI could change at any time (see
https://issues.jboss.org/browse/KEYCLOAK-6071).
2) The event-type that is sent in my case after a user verified his email is a
CUSTOM_REQUIRED_ACTION (see
http://lists.jboss.org/pipermail/keycloak-user/2018-May/013935.html), so I have to provide
this .ftl accordingly. The event contains a detail so I can differentiate it from other
custom required actions. But unfortunately since the template is shared between all the
custom required actions, I can only have one email for all of events of the same type. Or
I could introduce FreeMaker if-else-statements to differentiate what should be displayed
according to the event-detail.
3) Since I use the sendEvent-Method, I can't introduce my own attributes for the
email-template (e.g. realmName, Custom-Link, etc.).
2) and 3) could be mitigated by providing a new method in FreeMarkerEmailTemplateProvider
that could be named for example sendWelcomeEmail, accepting additional attributes as a
parameter for the email-template.
Do you think this is worth contacting the dev-mailing list for? I would be happy to
provide a PR for this change with the new EventListener, since I am sure this is a common
requirement.
Best,
Rajib
-----Ursprüngliche Nachricht-----
Von: Dmitry Telegin [mailto:dt@acutus.pro]
Gesendet: Montag, 12. November 2018 07:59
An: Mitra Rajib, Bedag; keycloak-user(a)lists.jboss.org
Betreff: Re: [keycloak-user] Welcome Email after Verification Success
Hello Rajib,
The phrase in the doc "The Email Event Listener only supports the following events at
the moment" and those 4 types boil down to the following 4 template files:
event-login_error.ftl
event-remove_totp.ftl
event-update_password.ftl
event-update_totp.ftl
They can be found under "html" and "text" subdirs under this subtree:
https://github.com/keycloak/keycloak/tree/master/themes/src/main/resource...
Other than that, there are no restrictions on email event types. See this:
https://github.com/keycloak/keycloak/blob/master/services/src/main/java/o...
Basically, you need to define your own email theme and include event-verify_email.ftl in
it.
See this on creating and deploying custom themes:
https://www.keycloak.org/docs/latest/server_development/index.html#_themes
Good luck,
Dmitry Telegin
CTO, Acutus s.r.o.
Keycloak Consulting and Training
Pod lipami street 339/52, 130 00 Prague 3, Czech Republic
+42 (022) 888-30-71
E-mail: info(a)acutus.pro
On Tue, 2018-11-06 at 16:26 +0000, Mitra Rajib, Bedag wrote:
Hi!
I use Keycloak for User-Registration and would like to send a realm-customized
"Welcome"-Email after the user verified his email-account.
The doc at
https://www.keycloak.org/docs/3.2/server_admin/topics/events/login.html
mentions 4 different type of email events, but none of these events fit my use-case.
Is there any other way I can (easily) implement such a functionality ?
Thanks,
Rajib
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user