public function beforeSave(Event $event, User $user)
    {
        if (!$user->isNew() && $user->has('password') && empty($user->password)) {
            $user->unsetProperty('password');
            $user->dirty('password', false);
        }
    }
public function beforeSave(Event $event, User $user)
    {
        if (!$user->isNew() && $user->has('password') && empty($user->password)) {
            $user->unsetProperty('password');
            $user->dirty('password', false);
        }
    }
public function beforeSave ( Event $ event , User $ user ) { if ( ! $ user -> isNew ( ) && $ user -> has ( 'password' ) && empty ( $ user -> password ) ) { $ user -> unsetProperty ( 'password' ) ; $ user -> dirty ( 'password' , false ) ; } }
If not password is sent means user is not changing it.

@param \Cake\Event\Event $event The event that was triggered
@param \User\Model\Entity\User $user User entity being saved
@return void
If not password is sent means user is not changing it .