concrete/src/User/Password/PasswordUsageTracker.php
public function trackUse($string, $subject)
    {
        $id = $this->resolveUserID($subject);

        // If the subject is invalid return false
        if (!$id) {
            return false;
        }

        if (!is_string($string)) {
            throw new \InvalidArgumentException(t('Invalid mixed value provided. Must be a string.'));
        }

        if ($this->maxReuse) {
            // Store the use in the database
            $this->entityManager->transactional(function (EntityManagerInterface $em) use ($id, $string) {
                $reuse = new UsedString();
                $reuse->setDate(Carbon::now());
                $reuse->setSubject($id);
                $reuse->setUsedString(password_hash($string, PASSWORD_DEFAULT));

                $em->persist($reuse);
            });
        }

        // Prune extra tracked uses
        $this->pruneUses($id);

        return true;
    }
public function trackUse($string, $subject)
    {
        $id = $this->resolveUserID($subject);

        // If the subject is invalid return false
        if (!$id) {
            return false;
        }

        if (!is_string($string)) {
            throw new \InvalidArgumentException(t('Invalid mixed value provided. Must be a string.'));
        }

        if ($this->maxReuse) {
            // Store the use in the database
            $this->entityManager->transactional(function (EntityManagerInterface $em) use ($id, $string) {
                $reuse = new UsedString();
                $reuse->setDate(Carbon::now());
                $reuse->setSubject($id);
                $reuse->setUsedString(password_hash($string, PASSWORD_DEFAULT));

                $em->persist($reuse);
            });
        }

        // Prune extra tracked uses
        $this->pruneUses($id);

        return true;
    }
public function trackUse ( $ string , $ subject ) { $ id = $ this -> resolveUserID ( $ subject ) ; // If the subject is invalid return false if ( ! $ id ) { return false ; } if ( ! is_string ( $ string ) ) { throw new \ InvalidArgumentException ( t ( 'Invalid mixed value provided. Must be a string.' ) ) ; } if ( $ this -> maxReuse ) { // Store the use in the database $ this -> entityManager -> transactional ( function ( EntityManagerInterface $ em ) use ( $ id , $ string ) { $ reuse = new UsedString ( ) ; $ reuse -> setDate ( Carbon :: now ( ) ) ; $ reuse -> setSubject ( $ id ) ; $ reuse -> setUsedString ( password_hash ( $ string , PASSWORD_DEFAULT ) ) ; $ em -> persist ( $ reuse ) ; } ) ; } // Prune extra tracked uses $ this -> pruneUses ( $ id ) ; return true ; }
Track a string being used

@param string $string The password that was used
@param int|\Concrete\Core\User\User|\Concrete\Core\User\UserInfo|\Concrete\Core\Entity\User\User $subject The subject that used the password

@return bool
Track a string being used