Spaces:
Running
Running
| <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> |