src/CRUDlex/PasswordReset.php
protected function getValidPasswordReset($token)
    {
        $passwordResets = $this->passwordResetData->listEntries(['token' => $token]);
        if (count($passwordResets) !== 1) {
            return null;
        }
        $passwordReset = $passwordResets[0];

        $createdAt = $passwordReset->get('created_at');
        if (strtotime($createdAt.' UTC') < time() - 2 * 24 * 60 * 60 || $passwordReset->get('reset')) {
            return null;
        }

        return $passwordReset;
    }
protected function getValidPasswordReset($token)
    {
        $passwordResets = $this->passwordResetData->listEntries(['token' => $token]);
        if (count($passwordResets) !== 1) {
            return null;
        }
        $passwordReset = $passwordResets[0];

        $createdAt = $passwordReset->get('created_at');
        if (strtotime($createdAt.' UTC') < time() - 2 * 24 * 60 * 60 || $passwordReset->get('reset')) {
            return null;
        }

        return $passwordReset;
    }
protected function getValidPasswordReset ( $ token ) { $ passwordResets = $ this -> passwordResetData -> listEntries ( [ 'token' => $ token ] ) ; if ( count ( $ passwordResets ) !== 1 ) { return null ; } $ passwordReset = $ passwordResets [ 0 ] ; $ createdAt = $ passwordReset -> get ( 'created_at' ) ; if ( strtotime ( $ createdAt . ' UTC' ) < time ( ) - 2 * 24 * 60 * 60 || $ passwordReset -> get ( 'reset' ) ) { return null ; } return $ passwordReset ; }
Gets the password reset of a token but only if it is younger than 48h.

@param string $token
the password reset token

@return null|CRUDlex\Entity
the password reset request
Gets the password reset of a token but only if it is younger than 48h .