Grails 3 Spring Security UI Forgotten Password blank URL & user
<p>I have customised <code>grails.plugin.springsecurity.userLookup.usernamePropertyName = "email"</code> but the default rendering behaviour for the email body will fail with:</p>

<p><code>No such property: username for class</code></p>

<p>Therefore I customised <code>emailBody</code> in my <code>application.groovy</code>:</p>

<p><code>grails.plugin.springsecurity.ui.forgotPassword.emailBody = "Dear ${user.email} , Please follow &lt;a href='${url}'&gt;this link&lt;/a&gt; to reset your password. This link will expire shortly."</code></p>

<p>because according to the docs:</p>

<blockquote>
  <p>The emailBody property should be a GString and will have the User domain class instance in scope in the user variable, and the generated url to click to reset the password in the url variable.</p>
</blockquote>

<p>However, the params map that contains the properties in my <code>MailStrategy</code> is empty for the <code>user.email</code> and <code>url</code> values:</p>

<pre><code>[to:blah@blah.com, 
 from:no-reply@blah.com, subject:Reset your password for your account,
 html:Dear [:], Please follow &lt;a href='[:']&gt;this link&lt;/a&gt; to reset your password. This link will expire shortly.]
</code></pre>

<p>Notice the <code>[:]</code> and <code>[:]</code> for the <code>user.email</code> and <code>url</code> values.</p>

<p>The spring-security plugin is configured with these values in <code>application.groovy</code>:</p>

<pre><code>grails.plugin.springsecurity.userLookup.userDomainClassName = 'blah.Account' 
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'blah.AccountRole' 
grails.plugin.springsecurity.authority.className = 'blah.Role' 
grails.plugin.springsecurity.requestMap.className = 'blah.Requestmap'     
grails.plugin.springsecurity.securityConfigType   = 'Annotation'
</code></pre>

<p>The <code>Account</code> class is defined as:</p>

<pre><code>String email
String password
Date emailVerified = null
boolean enabled = true
boolean accountExpired
boolean accountLocked
boolean passwordExpired

Set&lt;Role&gt; getAuthorities() {
    AccountRole.findAllByAccount(this)*.role
}

def beforeInsert() {
    encodePassword()
}

def beforeUpdate() {
    if (isDirty('password')) {
        encodePassword()
    }
}

protected void encodePassword() {
    password = springSecurityService?.passwordEncoder ? springSecurityService.encodePassword(password) : password
}

static transients = ['springSecurityService']

static constraints = {
    password blank: false, password: true
    email blank: false, unique: true
    emailVerified nullable: true
}

static mapping = {
    password column: '`password`'
}
</code></pre>

<p>How can I have the username and more importantly the URL rendered for me so I can send the forgotten password email?</p>