Does anyone know how to modify or override the default template that is used when you reset a password through the user interface?
I can’t find any documentation on it.
Cheers!
Hello,
The password for your CUBA Application account has been reset by administrator.
Please login with the following temporary password:
wkQr3A1k
and immediately create a new one for the further work.
Thank you,
CUBA Team
You can set your custom template location using application properties (use app.properties file of the core module):
cuba.security.resetPasswordTemplateSubject
cuba.security.resetPasswordTemplateBody
These email templates are based on Groovy SimpleTemplateEngine syntax, thus you can use Groovy blocks inside of the template content. For instance:
Hello, ${user.name}.
The password for your CUBA Application account has been reset by administrator.
Please login with the following temporary password:
${password}
and immediately create a new one for the further work.
Thank you,
CUBA Team
Data binding for these templates contains the following variables: user, password, persistence. In fact, you can use any Spring beans of the middleware if you import AppBeans class and get them using AppBeans.get() method.
Hi
that templates are not freemarker based, despite the official emailer APIs in CUBA (the ones you use in your code), are in fact based on freemarker.
You must use the SimpleTemplateEngine (Groovy based) syntax to perform special computations in the template.
for example this line prints the name of a User entity if not null, otherwise a generic user string: