Spaces:
Running
Running
File size: 8,546 Bytes
d2e555d 30b7646 d2e555d 30b7646 d2e555d | 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 | <!DOCTYPE html>
<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> |