I am using MongoDB and Spring Security Core and UI in my application. Almost everything works fine except for this bit:
def beforeUpdate() { if (isDirty('password')) { encodePassword() } }
which is part of the user domain class. I read that dirty checking was not yet supported by the MongoDB plugin. So I tried to implement my own:
if ( User.collection.findOne(id:id).password != password ) { encodePassword() }
But it does not work. I get the classic Cannot get property 'password' on null object.
Does anyone know how to reference an instance from a domain class definition? I also open up any best idea for doing a dirty check.
source share