Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Register | AuthPortal</title> | |
| <link rel="stylesheet" href="style.css"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: '#6366f1', | |
| secondary: '#a855f7', | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen"> | |
| <custom-header></custom-header> | |
| <main class="container mx-auto px-4 py-12 flex items-center justify-center"> | |
| <div class="w-full max-w-md bg-white rounded-xl shadow-md overflow-hidden p-8"> | |
| <div class="text-center mb-8"> | |
| <h1 class="text-3xl font-bold text-gray-900">Create your account</h1> | |
| <p class="text-gray-600 mt-2">Create your AuthPortal account</p> | |
| </div> | |
| <form id="registerForm" class="space-y-6"> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <label for="firstName" class="block text-sm font-medium text-gray-700 mb-1">First Name</label> | |
| <input type="text" id="firstName" name="firstName" required | |
| class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all"> | |
| </div> | |
| <div> | |
| <label for="lastName" class="block text-sm font-medium text-gray-700 mb-1">Last Name</label> | |
| <input type="text" id="lastName" name="lastName" required | |
| class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all"> | |
| </div> | |
| </div> | |
| <div> | |
| <label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email</label> | |
| <input type="email" id="email" name="email" required | |
| class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all"> | |
| </div> | |
| <div> | |
| <label for="password" class="block text-sm font-medium text-gray-700 mb-1">Password</label> | |
| <input type="password" id="password" name="password" required | |
| class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all"> | |
| <p class="mt-1 text-xs text-gray-500">Must be at least 8 characters</p> | |
| </div> | |
| <div> | |
| <label for="confirmPassword" class="block text-sm font-medium text-gray-700 mb-1">Confirm Password</label> | |
| <input type="password" id="confirmPassword" name="confirmPassword" required | |
| class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all"> | |
| </div> | |
| <div class="flex items-start"> | |
| <div class="flex items-center h-5"> | |
| <input id="terms" name="terms" type="checkbox" required | |
| class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded"> | |
| </div> | |
| <div class="ml-3 text-sm"> | |
| <label for="terms" class="text-gray-700">I agree to the <a href="/terms" class="text-primary-600 hover:text-primary-500">Terms of Service</a> and <a href="/privacy" class="text-primary-600 hover:text-primary-500">Privacy Policy</a></label> | |
| </div> | |
| </div> | |
| <button type="submit" | |
| class="w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-3 px-4 rounded-lg transition-all flex items-center justify-center"> | |
| <span id="registerBtnText">Create Account</span> | |
| <div id="registerSpinner" class="ml-2 hidden"> | |
| <div class="animate-spin rounded-full h-5 w-5 border-b-2 border-white"></div> | |
| </div> | |
| </button> | |
| </form> | |
| <div class="mt-6 text-center"> | |
| <p class="text-gray-600">Already have an account? <a href="/login" class="text-primary-600 hover:text-primary-500 font-medium">Log in</a></p> | |
| </div> | |
| <div class="relative mt-8"> | |
| <div class="absolute inset-0 flex items-center"> | |
| <div class="w-full border-t border-gray-300"></div> | |
| </div> | |
| <div class="relative flex justify-center text-sm"> | |
| <span class="px-2 bg-white text-gray-500">Or sign up with</span> | |
| </div> | |
| </div> | |
| <div class="mt-6 grid grid-cols-2 gap-3"> | |
| <a href="#" class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-lg bg-white text-sm font-medium text-gray-700 hover:bg-gray-50"> | |
| <i data-feather="github" class="h-5 w-5"></i> | |
| </a> | |
| <a href="#" class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-lg bg-white text-sm font-medium text-gray-700 hover:bg-gray-50"> | |
| <i data-feather="google" class="h-5 w-5"></i> | |
| </a> | |
| </div> | |
| </div> | |
| </main> | |
| <custom-footer></custom-footer> | |
| <script src="components/header.js"></script> | |
| <script src="components/footer.js"></script> | |
| <script src="script.js"></script> | |
| <script> | |
| feather.replace(); | |
| document.getElementById('registerForm').addEventListener('submit', async function(e) { | |
| e.preventDefault(); | |
| const firstName = document.getElementById('firstName').value; | |
| const lastName = document.getElementById('lastName').value; | |
| const email = document.getElementById('email').value; | |
| const password = document.getElementById('password').value; | |
| const confirmPassword = document.getElementById('confirmPassword').value; | |
| // Validate password match | |
| if (password !== confirmPassword) { | |
| alert('Passwords do not match'); | |
| return; | |
| } | |
| // Validate password length | |
| if (password.length < 8) { | |
| alert('Password must be at least 8 characters'); | |
| return; | |
| } | |
| // Validate email format | |
| if (!validateEmail(email)) { | |
| alert('Please enter a valid email address'); | |
| return; | |
| } | |
| // Show loading state | |
| document.getElementById('registerBtnText').textContent = 'Creating account...'; | |
| document.getElementById('registerSpinner').classList.remove('hidden'); | |
| // Prepare user data | |
| const userData = { | |
| firstName, | |
| lastName, | |
| email, | |
| password | |
| }; | |
| // Simulate API call | |
| try { | |
| const result = await simulateRegister(userData); | |
| if (result.success) { | |
| // Redirect to success page | |
| window.location.href = '/register-success'; | |
| } else { | |
| alert('Registration failed. Please try again.'); | |
| } | |
| } catch (error) { | |
| alert('An error occurred during registration. Please try again.'); | |
| } finally { | |
| // Reset button state | |
| document.getElementById('registerBtnText').textContent = 'Create Account'; | |
| document.getElementById('registerSpinner').classList.add('hidden'); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |