in plugin-ui/plugin/grails-app/controllers/grails/plugin/springsecurity/ui/RegisterController.groovy [212:244]
protected def processForgotPasswordEmail(forgotPasswordCommand,user){
if(requireForgotPassEmailValidation) {
String email = uiPropertiesStrategy.getProperty(user, 'email')
if (!email) {
forgotPasswordCommand.errors.rejectValue 'username', 'spring.security.ui.forgotPassword.noEmail'
return [forgotPasswordCommand: forgotPasswordCommand]
}
uiRegistrationCodeStrategy.sendForgotPasswordMail(
forgotPasswordCommand.username, email) { String registrationCodeToken ->
String url = generateLink('resetPassword', [t: registrationCodeToken])
String body = forgotPasswordEmailBody
if (!body) {
body = renderEmail(
FORGOT_PASSWORD_TEMPLATE, EMAIL_LAYOUT,
[
url : url,
username: user.username
]
)
} else if (body.contains('$')) {
body = evaluate(body, [user: user, url: url])
}
body
}
[emailSent: true, forgotPasswordCommand: forgotPasswordCommand]
} else {
return generateLink('resetPassword', [t: uiRegistrationCodeStrategy.sendForgotPasswordMail(forgotPasswordCommand.username)?.token ])
}
}