我已自定义grails.plugin.springsecurity.userLookup.usernamePropertyName = "email"
,但电子邮件正文的默认呈现行为将失败:
No such property: username for class
因此,我在emailBody
:
application.groovy
grails.plugin.springsecurity.ui.forgotPassword.emailBody = "Dear ${user.email} , Please follow <a href='${url}'>this link</a> to reset your password. This link will expire shortly."
因为根据文档:
emailBody属性应该是一个GString,并且在用户变量的范围内具有User域类实例,并且生成的url用于单击以重置url变量中的密码。
但是,对于MailStrategy
和user.email
值,包含我的url
中的属性的参数地图为空:
[to:blah@blah.com,
from:no-reply@blah.com, subject:Reset your password for your account,
html:Dear [:], Please follow <a href='[:']>this link</a> to reset your password. This link will expire shortly.]
请注意[:]
和[:]
的{{1}}和user.email
。
spring-security插件在url
:
application.groovy
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'
类定义为:
Account
我如何拥有用户名,更重要的是我为我呈现的网址,以便发送忘记密码的电子邮件?
答案 0 :(得分:0)
GString应该从&#34; 开始,而不是从&#39;
开始所以而不是grails.plugin.springsecurity.ui.forgotPassword.emailBody = '...'
你应该使用:grails.plugin.springsecurity.ui.forgotPassword.emailBody = "..."