public function validateDeviceConfirmationToken($username, $token)
    {
        $this->username = $username;

        if ($this->rateLimitReached()) {
            throw new LoginException('The current user session is block from login page.', 1);
        }

        $allowedList = $this->getMeta()->allowedDevices->val();
        if (!is_array($allowedList)) {
            return false;
        }

        $newAllowedList = $allowedList;
        $deviceId = $this->getDeviceFingerprint();
        $i = 0;
        foreach ($allowedList as $al) {
            if ($al['confirmed'] == false && $al['device'] == $deviceId && $token == $al['validationToken']) {
                $token = $this->crypt()->generateUserReadableString(32);
                $newAllowedList[$i]['confirmed'] = true;
                $newAllowedList[$i]['created'] = time();
                $newAllowedList[$i]['token'] = $token;


                $this->getMeta()->allowedDevices = $newAllowedList;
                $this->getMeta()->save();

                return $token;
            }
            $i++;
        }

        // validation cleanup (if validation was unsuccessful, we need to delete the token, a new one needs to be requested)
        $newAllowedList = [];
        foreach ($allowedList as $al) {
            if ($al['confirmed'] != false) {
                $newAllowedList[] = $al;
            }
        }
        $this->getMeta()->allowedDevices = $newAllowedList;
        $this->getMeta()->save();

        // increment login count
        $this->incrementLoginAttempts();

        return false;
    }