Spaces:
Running
Running
File size: 18,453 Bytes
21fe01f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Key Login</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">
<style>
.gradient-bg {
background: linear-gradient(135deg, #6e8efb, #a777e3);
}
.input-focus:focus {
box-shadow: 0 0 0 3px rgba(110, 142, 251, 0.3);
border-color: #6e8efb;
}
.switch-btn {
transition: all 0.3s ease;
}
.switch-btn.active {
background-color: #6e8efb;
color: white;
}
.api-key-masked {
letter-spacing: 2px;
filter: blur(4px);
transition: filter 0.3s ease;
}
.api-key-masked:hover {
filter: blur(0);
}
</style>
</head>
<body class="min-h-screen gradient-bg flex items-center justify-center p-4">
<div class="w-full max-w-md mx-auto">
<div class="bg-white rounded-2xl shadow-2xl overflow-hidden transition-all duration-300 transform hover:scale-[1.01]">
<!-- Header -->
<div class="bg-gradient-to-r from-indigo-500 to-purple-600 p-6 text-center">
<div class="flex justify-center mb-4">
<i class="fas fa-key text-white text-4xl"></i>
<i class="fas fa-cloud text-white text-4xl ml-2"></i>
</div>
<h1 class="text-2xl font-bold text-white">API Key Authentication</h1>
<p class="text-indigo-200 mt-1">Secure access to your cloud services</p>
</div>
<!-- Tabs -->
<div class="flex border-b">
<button id="login-tab" class="switch-btn active flex-1 py-3 font-medium text-gray-700 border-b-2 border-indigo-500">
<i class="fas fa-sign-in-alt mr-2"></i>Login
</button>
<button id="register-tab" class="switch-btn flex-1 py-3 font-medium text-gray-500 border-b-2 border-transparent">
<i class="fas fa-user-plus mr-2"></i>Register
</button>
</div>
<!-- Login Form -->
<div id="login-form" class="p-6 space-y-4">
<div>
<label for="api-key" class="block text-gray-700 mb-1 font-medium"><i class="fas fa-key mr-2"></i>API Key</label>
<div class="relative">
<input type="password" id="api-key" class="w-full px-4 py-2 border rounded-lg input-focus focus:outline-none" placeholder="sk-...">
<button class="absolute right-2 top-2 text-gray-500 hover:text-indigo-600" id="toggle-visibility">
<i class="fas fa-eye-slash"></i>
</button>
</div>
</div>
<div>
<label for="secret-key" class="block text-gray-700 mb-1 font-medium"><i class="fas fa-lock mr-2"></i>Secret Key (Optional)</label>
<input type="password" id="secret-key" class="w-full px-4 py-2 border rounded-lg input-focus focus:outline-none" placeholder="••••••••">
</div>
<div class="flex items-center">
<input type="checkbox" id="remember-me" class="rounded text-indigo-600 focus:ring-indigo-500">
<label for="remember-me" class="ml-2 text-gray-700">Remember my keys</label>
</div>
<button id="login-btn" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-lg hover:bg-indigo-700 transition duration-200 flex items-center justify-center">
<i class="fas fa-rocket mr-2"></i> Connect to API
</button>
<div class="text-center text-sm text-gray-500 mt-4">
<p>Need help? <a href="#" class="text-indigo-600 hover:underline">Contact support</a></p>
</div>
</div>
<!-- Register Form (Hidden by default) -->
<div id="register-form" class="p-6 space-y-4 hidden">
<div>
<label for="email" class="block text-gray-700 mb-1 font-medium"><i class="fas fa-envelope mr-2"></i>Email</label>
<input type="email" id="email" class="w-full px-4 py-2 border rounded-lg input-focus focus:outline-none" placeholder="your@email.com">
</div>
<div>
<label for="org-name" class="block text-gray-700 mb-1 font-medium"><i class="fas fa-building mr-2"></i>Organization</label>
<input type="text" id="org-name" class="w-full px-4 py-2 border rounded-lg input-focus focus:outline-none" placeholder="Your company">
</div>
<div>
<label for="use-case" class="block text-gray-700 mb-1 font-medium"><i class="fas fa-project-diagram mr-2"></i>Use Case</label>
<select id="use-case" class="w-full px-4 py-2 border rounded-lg input-focus focus:outline-none">
<option value="">Select an option</option>
<option value="development">Development</option>
<option value="production">Production</option>
<option value="testing">Testing</option>
<option value="research">Research</option>
</select>
</div>
<div class="text-xs text-gray-500">
<p>By registering, you agree to our <a href="#" class="text-indigo-600 hover:underline">Terms of Service</a> and acknowledge our <a href="#" class="text-indigo-600 hover:underline">Privacy Policy</a>.</p>
</div>
<button id="register-btn" class="w-full bg-purple-600 text-white py-2 px-4 rounded-lg hover:bg-purple-700 transition duration-200 flex items-center justify-center">
<i class="fas fa-key mr-2"></i> Request API Keys
</button>
<div class="text-center text-sm text-gray-500 mt-2">
<p>Already have keys? <a href="#" id="switch-to-login" class="text-indigo-600 hover:underline">Sign in</a></p>
</div>
</div>
</div>
<!-- API Status Indicator (Hidden by default) -->
<div id="status-card" class="hidden mt-6 bg-white rounded-xl shadow-lg p-4">
<div class="flex items-center">
<div class="mr-3">
<div id="status-indicator" class="w-4 h-4 rounded-full bg-gray-400 animate-pulse"></div>
</div>
<div class="flex-1">
<h3 id="status-title" class="text-gray-800 font-medium">Connecting to API...</h3>
<p id="status-message" class="text-gray-600 text-sm">Authenticating your keys</p>
</div>
<button id="edit-keys" class="text-indigo-600 hover:text-indigo-800 text-sm font-medium">
<i class="fas fa-edit mr-1"></i>Edit
</button>
</div>
<div id="credentials-display" class="mt-4 space-y-2 hidden">
<div class="flex justify-between items-center bg-gray-50 p-2 rounded">
<span class="text-gray-700 text-sm">API Key:</span>
<span id="display-api-key" class="api-key-masked font-mono text-sm bg-gray-100 px-2 py-1 rounded cursor-pointer" title="Click to show">sk-••••••••</span>
</div>
<div class="flex justify-between items-center bg-gray-50 p-2 rounded">
<span class="text-gray-700 text-sm">Secret Key:</span>
<span id="display-secret-key" class="api-key-masked font-mono text-sm bg-gray-100 px-2 py-1 rounded cursor-pointer" title="Click to show">••••••••</span>
</div>
<div class="flex justify-between items-center p-2">
<span class="text-gray-700 text-sm">Connection:</span>
<span id="connection-status" class="text-sm px-2 py-1 rounded">
<span class="text-gray-400"><i class="fas fa-circle-notch fa-spin mr-1"></i>Verifying</span>
</span>
</div>
</div>
</div>
</div>
<script>
// Tab switching
document.getElementById('login-tab').addEventListener('click', function() {
document.getElementById('login-tab').classList.add('active', 'border-indigo-500', 'text-gray-700');
document.getElementById('login-tab').classList.remove('border-transparent', 'text-gray-500');
document.getElementById('register-tab').classList.remove('active', 'border-indigo-500', 'text-gray-700');
document.getElementById('register-tab').classList.add('border-transparent', 'text-gray-500');
document.getElementById('login-form').classList.remove('hidden');
document.getElementById('register-form').classList.add('hidden');
});
document.getElementById('register-tab').addEventListener('click', function() {
document.getElementById('register-tab').classList.add('active', 'border-indigo-500', 'text-gray-700');
document.getElementById('register-tab').classList.remove('border-transparent', 'text-gray-500');
document.getElementById('login-tab').classList.remove('active', 'border-indigo-500', 'text-gray-700');
document.getElementById('login-tab').classList.add('border-transparent', 'text-gray-500');
document.getElementById('register-form').classList.remove('hidden');
document.getElementById('login-form').classList.add('hidden');
});
document.getElementById('switch-to-login').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('login-tab').click();
});
// Toggle password visibility
const toggleVisibilityBtn = document.getElementById('toggle-visibility');
const apiKeyInput = document.getElementById('api-key');
toggleVisibilityBtn.addEventListener('click', function() {
if (apiKeyInput.type === 'password') {
apiKeyInput.type = 'text';
toggleVisibilityBtn.innerHTML = '<i class="fas fa-eye"></i>';
} else {
apiKeyInput.type = 'password';
toggleVisibilityBtn.innerHTML = '<i class="fas fa-eye-slash"></i>';
}
});
// Login functionality
document.getElementById('login-btn').addEventListener('click', function() {
const apiKey = document.getElementById('api-key').value.trim();
const secretKey = document.getElementById('secret-key').value.trim();
const rememberMe = document.getElementById('remember-me').checked;
if (!apiKey) {
alert('Please enter your API Key');
return;
}
// Show loading state
const loginBtn = document.getElementById('login-btn');
loginBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Connecting...';
loginBtn.disabled = true;
// Simulate API connection with timeout
setTimeout(function() {
// Hide login form and show status card
document.getElementById('login-form').classList.add('hidden');
document.getElementById('status-card').classList.remove('hidden');
document.getElementById('credentials-display').classList.remove('hidden');
// Update status UI
const statusIndicator = document.getElementById('status-indicator');
const statusTitle = document.getElementById('status-title');
const statusMessage = document.getElementById('status-message');
const connectionStatus = document.getElementById('connection-status');
statusIndicator.classList.remove('bg-gray-400', 'bg-red-500', 'bg-green-500');
statusIndicator.classList.add('bg-green-500');
statusTitle.textContent = 'Connected to API';
statusMessage.textContent = 'Your credentials are valid';
connectionStatus.innerHTML = '<span class="text-green-600"><i class="fas fa-check-circle mr-1"></i>Verified</span>';
// Display the keys (masked)
document.getElementById('display-api-key').textContent = maskAPIKey(apiKey);
if (secretKey) {
document.getElementById('display-secret-key').textContent = '••••••••';
} else {
document.getElementById('display-secret-key').textContent = 'Not provided';
}
// Remember keys if checked
if (rememberMe) {
localStorage.setItem('apiKey', apiKey);
if (secretKey) {
localStorage.setItem('secretKey', secretKey);
}
}
// Reset login button
loginBtn.innerHTML = '<i class="fas fa-rocket mr-2"></i> Connect to API';
loginBtn.disabled = false;
}, 2000);
});
// Register functionality (simulated)
document.getElementById('register-btn').addEventListener('click', function() {
const email = document.getElementById('email').value.trim();
const orgName = document.getElementById('org-name').value.trim();
const useCase = document.getElementById('use-case').value;
if (!email || !orgName || !useCase) {
alert('Please fill all required fields');
return;
}
const registerBtn = document.getElementById('register-btn');
registerBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Processing...';
registerBtn.disabled = true;
setTimeout(function() {
alert('Your API key request has been submitted. Check your email for further instructions.');
registerBtn.innerHTML = '<i class="fas fa-key mr-2"></i> Request API Keys';
registerBtn.disabled = false;
// Clear form
document.getElementById('email').value = '';
document.getElementById('org-name').value = '';
document.getElementById('use-case').value = '';
}, 2000);
});
// Edit keys button
document.getElementById('edit-keys').addEventListener('click', function() {
document.getElementById('status-card').classList.add('hidden');
document.getElementById('login-form').classList.remove('hidden');
});
// Mask API key for display
function maskAPIKey(key) {
if (key.length < 8) return 'sk-••••••••';
const visible = key.substring(0, 6);
const masked = key.substring(6).replace(/./g, '•');
return visible + masked;
}
// Toggle between masked/unmasked API key display
document.getElementById('display-api-key').addEventListener('click', function(e) {
const elem = e.target;
if (elem.classList.contains('api-key-masked')) {
elem.classList.remove('api-key-masked');
elem.textContent = localStorage.getItem('apiKey') || document.getElementById('api-key').value.trim();
} else {
elem.classList.add('api-key-masked');
elem.textContent = maskAPIKey(localStorage.getItem('api-key') || document.getElementById('api-key').value.trim());
}
});
// Toggle between masked/unmasked secret key display
document.getElementById('display-secret-key').addEventListener('click', function(e) {
const elem = e.target;
if (elem.textContent !== 'Not provided') {
if (elem.classList.contains('api-key-masked')) {
elem.classList.remove('api-key-masked');
elem.textContent = localStorage.getItem('secretKey') || document.getElementById('secret-key').value.trim();
} else {
elem.classList.add('api-key-masked');
elem.textContent = '••••••••';
}
}
});
// Check for saved keys
window.addEventListener('DOMContentLoaded', function() {
const savedApiKey = localStorage.getItem('apiKey');
const savedSecretKey = localStorage.getItem('secretKey');
if (savedApiKey) {
document.getElementById('api-key').value = savedApiKey;
document.getElementById('remember-me').checked = true;
}
if (savedSecretKey) {
document.getElementById('secret-key').value = savedSecretKey;
}
});
</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=Akademics/api-key-authenticator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |