In mine, Config.groovyI used:
grails.plugins.springsecurity.useSecurityEventListener = true
grails.plugins.springsecurity.onInteractiveAuthenticationSuccessEvent = { e, appCtx ->
User.withTransaction {
def user = User.findById(appCtx.springSecurityService.principal.id)
if(!user.isAttached())
user.attach()
user.lastLoginDate = new Date()
user.save(flush: true, failOnError: true)
}
}
This field is in my user domain, and I do not receive any errors when logging in, but the field is not updated.
I tried debugging everything from org.hibernate, but I could not find any updateor other relevant statements.
Is there anything else I need to add anywhere to get this to work?
For the record:
- Grails 1.3.7
- Spring Security Core 1.1.2
- Hibernate 1.3.7
slhck source
share