Skip to main content
Version: Isle Royale (2.5.0)

Force Reacceptance

Learn how to verify user compliance and force users to accept updated terms when document versions change.

Overview​

When you publish a new version of your legal documents (Terms of Service, Privacy Policy, etc.), users who previously accepted the old version must accept the new version. ToughClicks provides tools to:

  • Verify if a user is compliant with the latest document versions
  • Determine if a user needs to reaccept terms
  • Force users to review and accept updated documents
  • Track user acceptance status

This is critical for maintaining legal compliance and ensuring users are bound by your current terms.

How Versioning Works​

ToughClicks documents use semantic versioning (MAJOR.MINOR):

  • MAJOR version - Significant changes requiring reacceptance (e.g., 1.0 → 2.0)
  • MINOR version - Minor updates, may or may not require reacceptance (e.g., 1.0 → 1.1)

When you publish a new version in the Management Portal, you can choose whether to require reacceptance.

Checking User Compliance​

A user is considered compliant if they have accepted any version within the same major version as the current version. For example, if a user has accepted version 1.0 and the current version is 1.5, they remain compliant until version 2.0 is released. This follows semantic versioning where major version changes (e.g., 1.x → 2.x) indicate significant changes requiring reacceptance.

The verify() Method​

Use the verify() method to check if a user has accepted the latest version of all documents:

import { ToughClicks } from '@toughclicks/js-client-sdk';

const tc = new ToughClicks(clientToken, packetId);

// Check if user is compliant
const result = await tc.verify({ userId: '[email protected]' });

console.log('User compliant:', result.userCompliant);

Verification Response​

The verify() method returns a TCVerificationResponse:

interface TCVerificationResponse {
displayName: string; // Packet name
id: string; // Packet ID
documents: TCDocumentVerificationResponse[];
userCompliant: boolean; // Overall compliance status
}

interface TCDocumentVerificationResponse {
id: string; // Document ID
displayName: string; // Document name
latestVersion: string; // Latest published version (e.g., "2.0")
latestAgreement: string; // Version user accepted (e.g., "1.0")
}

Example Verification​

const tc = new ToughClicks(clientToken, packetId);

const verification = await tc.verify({
userId: '[email protected]'
});

console.log('Packet:', verification.displayName);
console.log('User compliant:', verification.userCompliant);

verification.documents.forEach((doc) => {
console.log(`Document: ${doc.displayName}`);
console.log(` Latest version: ${doc.latestVersion}`);
console.log(` User's version: ${doc.latestAgreement || 'Never accepted'}`);

// Note: This simple comparison checks if versions are different.
// The userCompliant field already accounts for major version logic,
// where users are compliant within the same major version.
const needsReacceptance = doc.latestVersion !== doc.latestAgreement;
console.log(` Needs reacceptance: ${needsReacceptance}`);
});

Example Output​

Packet: User Agreements
User compliant: false

Document: Terms of Service
Latest version: 2.0
User's version: 1.0
Needs reacceptance: true

Document: Privacy Policy
Latest version: 1.5
User's version: 1.5
Needs reacceptance: false

Implementing Force Reacceptance​

Basic Flow​

  1. Check Compliance - Verify if user needs to reaccept
  2. Block Access - Prevent access to app until terms accepted
  3. Show Terms - Display ToughClicks acceptance UI
  4. Create Acceptance - User reviews and accepts new version
  5. Grant Access - Allow user to proceed

Simple Implementation​

import { ToughClicks, TCDisplayMethod } from '@toughclicks/js-client-sdk';

async function checkUserCompliance(userId) {
const tc = new ToughClicks(
'your-client-token',
'your-packet-id'
);

const verification = await tc.verify({ userId });

if (!verification.userCompliant) {
// User needs to accept new terms
await forceReacceptance(userId);
} else {
// User is compliant, proceed to app
redirectToApp();
}
}

async function forceReacceptance(userId) {
const tc = new ToughClicks(
'your-client-token',
'your-packet-id'
);

tc.setDisplayOptions({
containerId: 'tc-reacceptance',
signerId: userId,
displayMethod: TCDisplayMethod.individual,
shouldOpenModal: true,
manualAcceptance: false
});

// Listen for acceptance
tc.on('tc-accepted', (event) => {
if (event.detail.allAccepted) {
console.log('User accepted new terms');
redirectToApp();
}
});

await tc.render();
}

function redirectToApp() {
window.location.href = '/app';
}

Complete Example with UI​

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.toughclicks.com/lib/latest/toughclicks.css" />
<style>
.reacceptance-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 10000;
}

.reacceptance-content {
background: white;
padding: 30px;
border-radius: 8px;
max-width: 600px;
width: 90%;
}

.hidden {
display: none;
}
</style>
</head>
<body>
<!-- Reacceptance Modal -->
<div id="reacceptance-modal" class="reacceptance-modal hidden">
<div class="reacceptance-content">
<h2>Terms Update Required</h2>
<p>We've updated our legal agreements. Please review and accept the new terms to continue using our service.</p>
<div id="tc-reacceptance"></div>
<p class="note">You must accept all updated terms to proceed.</p>
</div>
</div>

<!-- Main App Content -->
<div id="app">
<h1>Loading...</h1>
</div>

<script src="https://cdn.toughclicks.com/lib/latest/toughclicks.umd.js"></script>
<script>
const { ToughClicks, TCDisplayMethod } = window.ToughClicks;

async function checkCompliance() {
const userId = getCurrentUserId(); // Your auth system
const tc = new ToughClicks(
'your-client-token',
'your-packet-id'
);

const verification = await tc.verify({ userId });

if (!verification.userCompliant) {
showReacceptanceModal(userId);
} else {
loadApp();
}
}

function showReacceptanceModal(userId) {
const modal = document.getElementById('reacceptance-modal');
modal.classList.remove('hidden');

const tc = new ToughClicks(
'your-client-token',
'your-packet-id'
);

tc.setDisplayOptions({
containerId: 'tc-reacceptance',
signerId: userId,
displayMethod: TCDisplayMethod.individual,
shouldOpenModal: true
});

tc.on('tc-accepted', (event) => {
if (event.detail.allAccepted) {
modal.classList.add('hidden');
loadApp();
}
});

tc.render();
}

function loadApp() {
document.getElementById('app').innerHTML = '<h1>Welcome to the App!</h1>';
}

function getCurrentUserId() {
// Get from your authentication system
return '[email protected]';
}

// Check compliance on page load
checkCompliance();
</script>
</body>
</html>

React Implementation​

Using Hooks​

import { useEffect, useState } from 'react';
import { ToughClicks, TCDisplayMethod } from '@toughclicks/js-client-sdk';
import '@toughclicks/js-client-sdk/toughclicks.css';

function App() {
const [isCompliant, setIsCompliant] = useState(null);
const [isLoading, setIsLoading] = useState(true);
const userId = useCurrentUser().email; // Your auth hook

useEffect(() => {
checkCompliance();
}, [userId]);

async function checkCompliance() {
const tc = new ToughClicks(
process.env.REACT_APP_TC_TOKEN,
process.env.REACT_APP_TC_PACKET_ID
);

try {
const verification = await tc.verify({ userId });
setIsCompliant(verification.userCompliant);
} catch (error) {
console.error('Compliance check failed:', error);
// Handle error appropriately
} finally {
setIsLoading(false);
}
}

if (isLoading) {
return <LoadingScreen />;
}

if (!isCompliant) {
return <ReacceptanceRequired userId={userId} onAccepted={() => setIsCompliant(true)} />;
}

return <MainApp />;
}

function ReacceptanceRequired({ userId, onAccepted }) {
useEffect(() => {
const tc = new ToughClicks(
process.env.REACT_APP_TC_TOKEN,
process.env.REACT_APP_TC_PACKET_ID
);

tc.setDisplayOptions({
containerId: 'tc-reacceptance',
signerId: userId,
displayMethod: TCDisplayMethod.individual,
shouldOpenModal: true
});

tc.on('tc-accepted', (event) => {
if (event.detail.allAccepted) {
onAccepted();
}
});

tc.render();
}, [userId, onAccepted]);

return (
<div className="reacceptance-modal">
<div className="reacceptance-content">
<h2>Terms Update Required</h2>
<p>We've updated our legal agreements. Please review and accept to continue.</p>
<div id="tc-reacceptance"></div>
</div>
</div>
);
}

With Context Provider​

import { createContext, useContext, useState, useEffect } from 'react';
import { ToughClicks } from '@toughclicks/js-client-sdk';

const ComplianceContext = createContext();

export function ComplianceProvider({ children }) {
const [isCompliant, setIsCompliant] = useState(null);
const [isChecking, setIsChecking] = useState(true);
const userId = useCurrentUser().email;

useEffect(() => {
checkCompliance();
}, [userId]);

async function checkCompliance() {
setIsChecking(true);
const tc = new ToughClicks(
process.env.REACT_APP_TC_TOKEN,
process.env.REACT_APP_TC_PACKET_ID
);

try {
const verification = await tc.verify({ userId });
setIsCompliant(verification.userCompliant);
} catch (error) {
console.error('Compliance check error:', error);
setIsCompliant(false);
} finally {
setIsChecking(false);
}
}

return (
<ComplianceContext.Provider value={{ isCompliant, isChecking, recheckCompliance: checkCompliance }}>
{children}
</ComplianceContext.Provider>
);
}

export function useCompliance() {
return useContext(ComplianceContext);
}

// Usage
function App() {
const { isCompliant, isChecking } = useCompliance();

if (isChecking) return <LoadingScreen />;
if (!isCompliant) return <ReacceptanceGate />;

return <MainApp />;
}

Best Practices​

1. Check on Login​

Verify compliance when users log in:

async function onUserLogin(userId) {
const isCompliant = await checkCompliance(userId);

if (!isCompliant) {
redirectToReacceptance();
} else {
redirectToDashboard();
}
}

2. Periodic Checks​

Recheck compliance periodically for long-lived sessions:

// Check every 24 hours
setInterval(async () => {
const userId = getCurrentUser().email;
const isCompliant = await checkCompliance(userId);

if (!isCompliant) {
showReacceptanceModal();
}
}, 24 * 60 * 60 * 1000);

3. Provide Clear Messaging​

Explain why reacceptance is required:

<div class="reacceptance-notice">
<h2>We've Updated Our Terms</h2>
<p>We've made important updates to our legal agreements to:</p>
<ul>
<li>Clarify our data practices</li>
<li>Add new features and services</li>
<li>Improve user protections</li>
</ul>
<p>Please review and accept the updated terms to continue using our service.</p>
</div>

4. Log Compliance Checks​

Track compliance checks for auditing:

async function checkCompliance(userId) {
const tc = new ToughClicks(clientToken, packetId);
const verification = await tc.verify({ userId });

// Log the check
await logComplianceCheck({
userId,
timestamp: new Date(),
isCompliant: verification.userCompliant,
documents: verification.documents
});

return verification.userCompliant;
}

5. Avoid Excessive Verification Calls​

Do not place compliance verification in route guards or components that trigger on every page navigation. This will cause verify() to run excessively, leading to poor performance and unnecessary API calls.

// ❌ BAD: Don't do this in React Router or similar
function TermsGuard({ children }) {
const [isCompliant, setIsCompliant] = useState(false);

useEffect(() => {
// This runs on EVERY route change - very inefficient!
checkCompliance(userId).then(setIsCompliant);
}, []);

return isCompliant ? children : <ReacceptanceRequired />;
}

// ✅ GOOD: Check once on login or app initialization
function App() {
useEffect(() => {
// Check only once when app loads
checkCompliance(userId);
}, []);

return <YourApp />;
}

Troubleshooting​

Verification Always Returns False​

Check:

  • User ID is correct and matches signer ID used during acceptance
  • User has previously accepted at least one version
  • Packet ID is correct

Verification Throws Error​

Common causes:

  • Invalid client token
  • Network connectivity issues
  • User ID not found

Enable debug mode:

tc.setDebug(true);
const verification = await tc.verify({ userId });

Next Steps​