Spaces:
Running

captcha / index.html
iDmar1's picture
Make best design - Initial Deployment
57b7804 verified
Raw History Blame Contribute Delete
21.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Security Verification | CAPTCHA</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#3b82f6',
secondary: '#1e40af',
accent: '#f59e0b',
dark: '#1e293b',
light: '#f8fafc'
}
}
}
}
</script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #1e3a8a, #3b82f6);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.captcha-container {
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
transition: all 0.3s ease;
max-width: 450px;
width: 100%;
}
.captcha-container:hover {
transform: translateY(-5px);
box-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.3);
}
.captcha-box {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 16px;
padding: 24px;
position: relative;
overflow: hidden;
}
.captcha-box::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: conic-gradient(
transparent,
rgba(255, 255, 255, 0.2),
transparent 30%
);
animation: rotate 4s linear infinite;
z-index: 1;
}
.captcha-box-inner {
position: relative;
z-index: 2;
background: rgba(255, 255, 255, 0.9);
border-radius: 12px;
padding: 20px;
}
.captcha-text {
font-family: 'Courier New', monospace;
letter-spacing: 5px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
background: linear-gradient(45deg, #3b82f6, #8b5cf6, #ec4899);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
position: relative;
display: inline-block;
font-size: 2.5rem;
font-weight: 700;
text-align: center;
width: 100%;
padding: 10px 0;
}
.captcha-character {
display: inline-block;
transform: rotate(0deg);
position: relative;
margin: 0 2px;
text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.captcha-character:nth-child(2n) {
transform: rotate(-3deg) translateY(2px);
font-weight: 800;
}
.captcha-character:nth-child(3n) {
transform: rotate(4deg) translateY(-1px);
font-weight: 600;
}
.captcha-noise {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px),
radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
background-size: 10px 10px, 15px 15px;
pointer-events: none;
z-index: 1;
}
.refresh-btn {
transition: all 0.3s ease;
background: linear-gradient(45deg, #3b82f6, #1d4ed8);
border: none;
color: white;
padding: 10px 15px;
border-radius: 50px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
font-weight: 500;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.refresh-btn:hover {
transform: rotate(10deg);
background: linear-gradient(45deg, #1d4ed8, #3b82f6);
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
.refresh-btn:active {
transform: rotate(0);
}
.input-field {
transition: all 0.3s ease;
border: 2px solid transparent;
border-radius: 12px;
padding: 14px 16px;
font-size: 1rem;
}
.input-field:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
.submit-btn {
transition: all 0.3s ease;
background: linear-gradient(45deg, #3b82f6, #1d4ed8);
border: none;
color: white;
padding: 16px;
border-radius: 12px;
font-weight: 600;
font-size: 1.1rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
position: relative;
overflow: hidden;
}
.submit-btn:hover {
background: linear-gradient(45deg, #2563eb, #1e40af);
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.submit-btn:active {
transform: translateY(0);
}
.submit-btn::after {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: rgba(255, 255, 255, 0.1);
transform: rotate(30deg);
transition: all 0.6s ease;
}
.submit-btn:hover::after {
transform: rotate(30deg) translate(20%, 20%);
}
.success-message {
animation: fadeIn 0.5s ease;
background: linear-gradient(45deg, #10b981, #059669);
color: white;
border-radius: 12px;
padding: 20px;
text-align: center;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.error-message {
animation: shake 0.5s ease;
background: linear-gradient(45deg, #ef4444, #dc2626);
color: white;
border-radius: 12px;
padding: 15px;
text-align: center;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-5px); }
75% { transform: translateX(5px); }
}
.loading-spinner {
display: none;
width: 24px;
height: 24px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top-color: white;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.robot-icon {
animation: float 3s ease-in-out infinite;
text-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
@keyframes float {
0% { transform: translateY(0px); }
50% { transform: translateY(-15px); }
100% { transform: translateY(0px); }
}
@keyframes rotate {
100% {
transform: rotate(360deg);
}
}
.audio-btn {
background: linear-gradient(45deg, #8b5cf6, #7c3aed);
border: none;
color: white;
padding: 10px 15px;
border-radius: 50px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
font-weight: 500;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.audio-btn:hover {
background: linear-gradient(45deg, #7c3aed, #6d28d9);
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
.checkbox-container {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px;
background: rgba(59, 130, 246, 0.05);
border-radius: 12px;
margin-bottom: 20px;
}
.checkbox-container input {
margin-top: 3px;
}
.checkbox-container a {
color: #3b82f6;
font-weight: 500;
text-decoration: none;
}
.checkbox-container a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="captcha-container bg-white rounded-2xl overflow-hidden">
<div class="bg-gradient-to-r from-primary to-secondary p-8 text-center">
<div class="flex justify-center mb-4">
<i class="fas fa-robot text-6xl text-white robot-icon"></i>
</div>
<h1 class="text-3xl font-bold text-white mb-2">Security Verification</h1>
<p class="text-blue-100 text-lg">Please verify you're human to continue</p>
</div>
<div class="p-6">
<div class="text-center mb-6">
<p class="text-gray-600 mb-4 text-lg">Enter the characters you see below</p>
<div class="captcha-box">
<div class="captcha-noise"></div>
<div class="captcha-box-inner">
<div id="captchaDisplay" class="captcha-text select-none"></div>
</div>
<div class="flex justify-between items-center mt-4 px-2">
<button id="audioCaptcha" class="audio-btn">
<i class="fas fa-volume-up"></i>
<span>Audio</span>
</button>
<button id="refreshCaptcha" class="refresh-btn">
<i class="fas fa-sync-alt"></i>
<span>Refresh</span>
</button>
</div>
</div>
</div>
<div class="mb-6">
<label for="captchaInput" class="block text-gray-700 font-medium mb-3 text-lg">Type the characters:</label>
<input
type="text"
id="captchaInput"
class="input-field w-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="Enter CAPTCHA text"
autocomplete="off"
>
<div id="errorMessage" class="text-red-500 text-sm mt-2 hidden"></div>
</div>
<div class="checkbox-container">
<input
type="checkbox"
id="privacyPolicy"
class="h-5 w-5 text-blue-600 rounded focus:ring-blue-500"
>
<label for="privacyPolicy" class="text-gray-700 text-sm">
I agree to the <a href="#" class="text-blue-600 hover:underline">Privacy Policy</a> and <a href="#" class="text-blue-600 hover:underline">Terms of Service</a>
</label>
</div>
<button id="submitBtn" class="submit-btn w-full flex items-center justify-center">
<span id="btnText">Verify & Continue</span>
<div id="loadingSpinner" class="loading-spinner ml-2"></div>
</button>
<div id="successMessage" class="success-message mt-6 hidden">
<div class="flex items-center justify-center">
<i class="fas fa-check-circle text-2xl mr-3"></i>
<span class="text-lg font-medium">Verification successful! Redirecting...</span>
</div>
</div>
</div>
<div class="bg-gray-50 px-6 py-4 text-center text-sm text-gray-500 border-t">
<p>Protected by advanced security measures</p>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Generate initial CAPTCHA
generateCaptcha();
// Refresh CAPTCHA on button click
document.getElementById('refreshCaptcha').addEventListener('click', generateCaptcha);
// Handle form submission
document.getElementById('submitBtn').addEventListener('click', validateCaptcha);
// Handle Enter key in input field
document.getElementById('captchaInput').addEventListener('keyup', function(event) {
if (event.key === 'Enter') {
validateCaptcha();
}
});
// Generate a random CAPTCHA
function generateCaptcha() {
const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789@#$%&*';
let captcha = '';
for (let i = 0; i < 6; i++) {
captcha += chars.charAt(Math.floor(Math.random() * chars.length));
}
displayCaptcha(captcha);
document.getElementById('captchaInput').value = '';
document.getElementById('errorMessage').classList.add('hidden');
document.getElementById('successMessage').classList.add('hidden');
}
// Display CAPTCHA with visual distortions
function displayCaptcha(text) {
const display = document.getElementById('captchaDisplay');
display.innerHTML = '';
// Add each character with individual styling
for (let i = 0; i < text.length; i++) {
const charSpan = document.createElement('span');
charSpan.className = 'captcha-character';
charSpan.textContent = text[i];
charSpan.style.transform = `rotate(${Math.random() * 10 - 5}deg) scale(${1 + Math.random() * 0.2})`;
charSpan.style.display = 'inline-block';
display.appendChild(charSpan);
}
// Add noise effect
const noise = document.querySelector('.captcha-noise');
noise.style.backgroundImage = `
radial-gradient(circle, rgba(0,0,0,${0.05 + Math.random() * 0.1}) 1px, transparent 1px),
radial-gradient(circle, rgba(255,255,255,${0.05 + Math.random() * 0.1}) 1px, transparent 1px)
`;
}
// Validate CAPTCHA input
function validateCaptcha() {
const userInput = document.getElementById('captchaInput').value.trim().toUpperCase();
const captchaText = document.getElementById('captchaDisplay').textContent;
const errorMessage = document.getElementById('errorMessage');
const successMessage = document.getElementById('successMessage');
const submitBtn = document.getElementById('submitBtn');
const btnText = document.getElementById('btnText');
const loadingSpinner = document.getElementById('loadingSpinner');
// Check if privacy policy is accepted
if (!document.getElementById('privacyPolicy').checked) {
errorMessage.textContent = 'Please accept the Privacy Policy and Terms of Service';
errorMessage.classList.remove('hidden');
errorMessage.classList.add('error-message');
return;
}
// Validate input
if (userInput === '') {
errorMessage.textContent = 'Please enter the CAPTCHA text';
errorMessage.classList.remove('hidden');
errorMessage.classList.add('error-message');
return;
}
// Additional validation for bot prevention
const timeTaken = Date.now() - startTime;
if (timeTaken < 1000) {
errorMessage.textContent = 'Verification failed. Please take more time to enter the CAPTCHA.';
errorMessage.classList.remove('hidden');
errorMessage.classList.add('error-message');
generateCaptcha();
return;
}
// Check for common bot patterns
if (userInput.length !== document.getElementById('captchaDisplay').textContent.length) {
errorMessage.textContent = 'Incorrect CAPTCHA. Please try again.';
errorMessage.classList.remove('hidden');
errorMessage.classList.add('error-message');
generateCaptcha();
return;
}
// Show loading state
submitBtn.disabled = true;
btnText.textContent = 'Verifying...';
loadingSpinner.style.display = 'block';
// Simulate network delay
setTimeout(() => {
if (userInput === captchaText) {
// Success - send data to server
sendVerificationData();
// Show success message
successMessage.classList.remove('hidden');
errorMessage.classList.add('hidden');
} else {
// Failure
errorMessage.textContent = 'Incorrect CAPTCHA. Please try again.';
errorMessage.classList.remove('hidden');
errorMessage.classList.add('error-message');
generateCaptcha();
}
// Reset button state
submitBtn.disabled = false;
btnText.textContent = 'Verify & Continue';
loadingSpinner.style.display = 'none';
}, 1500);
}
// Send verification data to server
function sendVerificationData() {
// In a real implementation, this would send to your Express server
// For demo purposes, we'll simulate this
// Get user's IP (in a real app, this would be done server-side)
const userIP = '192.168.1.100'; // Simulated IP
// Log to console (would be sent to server)
console.log('Sending verification data to server...');
console.log('CAPTCHA passed:', document.getElementById('captchaDisplay').textContent);
console.log('User IP:', userIP);
console.log('Timestamp:', new Date().toISOString());
// Simulate redirect after success
setTimeout(() => {
alert('Verification successful! In a real application, you would be redirected to the main page.');
}, 2000);
}
// Track start time for bot detection
let startTime;
document.getElementById('captchaInput').addEventListener('focus', function() {
startTime = Date.now();
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=iDmar1/captcha" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>