I am using MongoDB and Spring Security Core and UI on my application. Nearly everything works perfectly, except this bit:
def beforeUpdate() {
if (isDirty('password')) {
encodePassword()
}
}
which is part of the User domain class. I have read that dirty checking was not supported by the MongoDB plugin yet. So I tried to implement my own like this:
if ( User.collection.findOne(id:id).password != password ) {
encodePassword()
}
But it is not working. I get the classical Cannot get property 'password' on null object.
Does anyone know how to reference an instance from the domain class definition ? I am also open to any better idea to implement the dirty checking.