- Add Go modules with required dependencies (Gin, UUID, JWT, etc.) - Implement main web server with landing page endpoint - Add comprehensive API endpoints for health and status - Include proper error handling and request validation - Set up CORS middleware and security headers
245 lines
8.0 KiB
HTML
245 lines
8.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Register - YourDreamNameHere</title>
|
|
<link rel="stylesheet" href="/static/css/style.css">
|
|
<link rel="icon" type="image/x-icon" href="/static/images/favicon.ico">
|
|
<style>
|
|
.auth-container {
|
|
max-width: 400px;
|
|
margin: 120px auto 2rem;
|
|
padding: 2rem;
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.auth-header {
|
|
text-align: center;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.auth-title {
|
|
font-size: 1.8rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.auth-subtitle {
|
|
color: #666;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.form-input {
|
|
width: 100%;
|
|
padding: 0.75rem;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 6px;
|
|
font-size: 1rem;
|
|
transition: border-color 0.3s ease;
|
|
}
|
|
|
|
.form-input:focus {
|
|
outline: none;
|
|
border-color: #2563eb;
|
|
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
|
|
}
|
|
|
|
.form-input.error {
|
|
border-color: #dc2626;
|
|
}
|
|
|
|
.error-message {
|
|
color: #dc2626;
|
|
font-size: 0.875rem;
|
|
margin-top: 0.25rem;
|
|
}
|
|
|
|
.auth-footer {
|
|
text-align: center;
|
|
margin-top: 1.5rem;
|
|
color: #666;
|
|
}
|
|
|
|
.auth-footer a {
|
|
color: #2563eb;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.auth-footer a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header class="header">
|
|
<nav class="nav">
|
|
<div class="nav-container">
|
|
<a href="/" class="nav-logo">
|
|
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z"/>
|
|
</svg>
|
|
<span class="logo-text">YourDreamNameHere</span>
|
|
</a>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main>
|
|
<div class="auth-container">
|
|
<div class="auth-header">
|
|
<h1 class="auth-title">Create Account</h1>
|
|
<p class="auth-subtitle">Start your sovereign hosting journey</p>
|
|
</div>
|
|
|
|
<form id="registerForm" action="/api/v1/register" method="POST">
|
|
<div class="form-group">
|
|
<label for="email" class="form-label">Email Address</label>
|
|
<input
|
|
type="email"
|
|
id="email"
|
|
name="email"
|
|
class="form-input"
|
|
required
|
|
placeholder="your@email.com"
|
|
autocomplete="email"
|
|
>
|
|
<div class="error-message" id="email-error"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="firstName" class="form-label">First Name</label>
|
|
<input
|
|
type="text"
|
|
id="firstName"
|
|
name="first_name"
|
|
class="form-input"
|
|
required
|
|
placeholder="John"
|
|
autocomplete="given-name"
|
|
>
|
|
<div class="error-message" id="firstName-error"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="lastName" class="form-label">Last Name</label>
|
|
<input
|
|
type="text"
|
|
id="lastName"
|
|
name="last_name"
|
|
class="form-input"
|
|
required
|
|
placeholder="Doe"
|
|
autocomplete="family-name"
|
|
>
|
|
<div class="error-message" id="lastName-error"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="password" class="form-label">Password</label>
|
|
<input
|
|
type="password"
|
|
id="password"
|
|
name="password"
|
|
class="form-input"
|
|
required
|
|
placeholder="••••••••"
|
|
autocomplete="new-password"
|
|
minlength="8"
|
|
>
|
|
<div class="error-message" id="password-error"></div>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary" style="width: 100%;">
|
|
Create Account
|
|
</button>
|
|
</form>
|
|
|
|
<div class="auth-footer">
|
|
Already have an account? <a href="/login">Sign in</a>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<script>
|
|
document.getElementById('registerForm').addEventListener('submit', async function(e) {
|
|
e.preventDefault();
|
|
|
|
const formData = new FormData(this);
|
|
const data = {
|
|
email: formData.get('email'),
|
|
first_name: formData.get('first_name'),
|
|
last_name: formData.get('last_name'),
|
|
password: formData.get('password')
|
|
};
|
|
|
|
try {
|
|
const response = await fetch('/api/v1/register', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify(data)
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (response.ok) {
|
|
showNotification('Account created successfully! Redirecting to login...', 'success');
|
|
setTimeout(() => {
|
|
window.location.href = '/login';
|
|
}, 2000);
|
|
} else {
|
|
showNotification(result.error || 'Registration failed', 'error');
|
|
}
|
|
} catch (error) {
|
|
showNotification('Network error. Please try again.', 'error');
|
|
}
|
|
});
|
|
|
|
// Real-time validation
|
|
const emailInput = document.getElementById('email');
|
|
const passwordInput = document.getElementById('password');
|
|
|
|
emailInput.addEventListener('blur', function() {
|
|
const email = this.value.trim();
|
|
const emailError = document.getElementById('email-error');
|
|
|
|
if (email && !isValidEmail(email)) {
|
|
this.classList.add('error');
|
|
emailError.textContent = 'Please enter a valid email address';
|
|
} else {
|
|
this.classList.remove('error');
|
|
emailError.textContent = '';
|
|
}
|
|
});
|
|
|
|
passwordInput.addEventListener('input', function() {
|
|
const password = this.value;
|
|
const passwordError = document.getElementById('password-error');
|
|
|
|
if (password.length > 0 && password.length < 8) {
|
|
this.classList.add('error');
|
|
passwordError.textContent = 'Password must be at least 8 characters';
|
|
} else {
|
|
this.classList.remove('error');
|
|
passwordError.textContent = '';
|
|
}
|
|
});
|
|
|
|
function isValidEmail(email) {
|
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |