src/CRUDlex/UserSetup.php
protected function getPWHashFunction(AbstractData $data, $passwordField, $saltField)
    {
        $that = $this;
        return function(Entity $entity) use ($data, $passwordField, $saltField, $that) {
            $password = $entity->get($passwordField);

            if (!$password) {
                return true;
            }

            $salt = $entity->get($saltField);
            $newSalt = $that->possibleGenSalt($salt, $entity, $saltField);

            $passwordHash = $this->encoder->encodePassword($password, $salt);

            $doGenerateHash = $that->doGenerateHash($data, $entity, $passwordField, $password, $newSalt);

            if ($doGenerateHash) {
                $entity->set($passwordField, $passwordHash);
            }
            return true;
        };
    }
protected function getPWHashFunction(AbstractData $data, $passwordField, $saltField)
    {
        $that = $this;
        return function(Entity $entity) use ($data, $passwordField, $saltField, $that) {
            $password = $entity->get($passwordField);

            if (!$password) {
                return true;
            }

            $salt = $entity->get($saltField);
            $newSalt = $that->possibleGenSalt($salt, $entity, $saltField);

            $passwordHash = $this->encoder->encodePassword($password, $salt);

            $doGenerateHash = $that->doGenerateHash($data, $entity, $passwordField, $password, $newSalt);

            if ($doGenerateHash) {
                $entity->set($passwordField, $passwordHash);
            }
            return true;
        };
    }
protected function getPWHashFunction ( AbstractData $ data , $ passwordField , $ saltField ) { $ that = $ this ; return function ( Entity $ entity ) use ( $ data , $ passwordField , $ saltField , $ that ) { $ password = $ entity -> get ( $ passwordField ) ; if ( ! $ password ) { return true ; } $ salt = $ entity -> get ( $ saltField ) ; $ newSalt = $ that -> possibleGenSalt ( $ salt , $ entity , $ saltField ) ; $ passwordHash = $ this -> encoder -> encodePassword ( $ password , $ salt ) ; $ doGenerateHash = $ that -> doGenerateHash ( $ data , $ entity , $ passwordField , $ password , $ newSalt ) ; if ( $ doGenerateHash ) { $ entity -> set ( $ passwordField , $ passwordHash ) ; } return true ; } ; }
Gets a closure for possibly generating a password hash in the entity.

@param AbstractData $data
the AbstractData instance managing the users

@param string $passwordField
the Entity fieldname of the password hash

@param string $saltField
the Entity fieldname of the password hash salt
Gets a closure for possibly generating a password hash in the entity .