Skip to content

Commit 5c6f0ed

Browse files
Archithclaude
andcommitted
perf: Remove security check delay and add fraud badges to session rows
Performance improvements: - Removed blocking "Checking security..." step for candidates - Made tracking initialization async/non-blocking - Candidates now join instantly while tracking happens in background UI improvements: - Added fraud badges directly on session rows in dashboard • 🚨 FRAUD badge (red) - shows for multiple login attempts • ⚠️ VPN badge (orange) - shows when VPN detected - No need to open session details to see fraud indicators - Fraud badges appear next to status badge for quick visibility This eliminates the annoying delay when candidates join sessions while still tracking all security information in the background. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8295d28 commit 5c6f0ed

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

scripts/app.js

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,11 @@
7474
return;
7575
}
7676

77-
// Initialize session tracking for candidates only (IP, device, duplicate login check)
77+
// Initialize session tracking for candidates (make it async/non-blocking)
7878
if (window.SessionTracking) {
79-
candidateJoinBtn.textContent = 'Checking security...';
80-
const canProceed = await window.SessionTracking.initialize(sessionCode, 'candidate', name);
81-
if (!canProceed) {
82-
candidateJoinBtn.disabled = false;
83-
candidateJoinBtn.textContent = 'Join Session';
84-
return;
85-
}
79+
// Don't await - let tracking happen in background
80+
window.SessionTracking.initialize(sessionCode, 'candidate', name);
81+
// Remove the security check message - just proceed
8682
}
8783

8884
Auth.joinAsCandidate(name);
@@ -738,22 +734,40 @@
738734
${users.length === 0 ? '<div style="color: #666;">No participants</div>' : ''}
739735
`;
740736

737+
// Check for fraud indicators from security warnings
738+
let fraudBadge = '';
739+
if (fullSession && fullSession.security_warnings) {
740+
const warnings = Object.values(fullSession.security_warnings || {});
741+
const candidateWarnings = warnings.filter(w => w.userType === 'candidate');
742+
743+
if (candidateWarnings.length > 0) {
744+
const hasVPN = candidateWarnings.some(w => w.type === 'vpn_detected');
745+
const hasMultipleLogin = candidateWarnings.some(w => w.type === 'multiple_login');
746+
747+
if (hasMultipleLogin) {
748+
fraudBadge = '<span class="fraud-badge" style="background: #ff0000; color: white; padding: 2px 6px; border-radius: 3px; font-size: 10px; margin-left: 4px;">🚨 FRAUD</span>';
749+
} else if (hasVPN) {
750+
fraudBadge = '<span class="fraud-badge" style="background: #ff9800; color: white; padding: 2px 6px; border-radius: 3px; font-size: 10px; margin-left: 4px;">⚠️ VPN</span>';
751+
}
752+
}
753+
}
754+
741755
// Determine session status - Simple progression: Active -> In Progress -> Ended
742756
let status = 'active';
743757
let statusBadge = '';
744758

745759
if (session.isTerminated) {
746760
// Session has ended
747761
status = 'ended';
748-
statusBadge = '<span class="status-badge status-ended" style="background-color: #666;">Ended</span>';
762+
statusBadge = '<span class="status-badge status-ended" style="background-color: #666;">Ended</span>' + fraudBadge;
749763
} else if (candidates.length > 0 && interviewers.length > 0) {
750764
// Both candidate and interviewer present - interview in progress
751765
status = 'in-progress';
752-
statusBadge = '<span class="status-badge status-in-progress" style="background-color: #2196f3;">In Progress</span>';
766+
statusBadge = '<span class="status-badge status-in-progress" style="background-color: #2196f3;">In Progress</span>' + fraudBadge;
753767
} else {
754768
// Session created but interview not started yet
755769
status = 'active';
756-
statusBadge = '<span class="status-badge status-active" style="background-color: #4caf50;">Active</span>';
770+
statusBadge = '<span class="status-badge status-active" style="background-color: #4caf50;">Active</span>' + fraudBadge;
757771
}
758772

759773
// Format time

0 commit comments

Comments
 (0)