voice-detector / frontend /register.html
jawaduddin
Force rebuild v5.3 - Fix frontend raw code
c574beb
Raw History Blame Contribute Delete
8.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register - AI Voice Detection</title>
<link rel="stylesheet" href="styles.css?v=5">
<script src="theme.js?v=4"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.auth-container {
max-width: 450px;
margin: 80px auto;
padding: 40px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.auth-header {
text-align: center;
margin-bottom: 30px;
}
.auth-header h1 {
font-size: 28px;
color: #333;
margin-bottom: 8px;
}
.auth-header p {
color: #666;
font-size: 14px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
color: #333;
font-weight: 500;
font-size: 14px;
}
.form-group input {
width: 100%;
padding: 12px 16px;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 15px;
transition: border-color 0.3s;
}
.form-group input:focus {
outline: none;
border-color: #4a90e2;
}
.btn-primary {
width: 100%;
padding: 14px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}
.btn-primary:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.auth-footer {
text-align: center;
margin-top: 24px;
color: #666;
font-size: 14px;
}
.auth-footer a {
color: #667eea;
text-decoration: none;
font-weight: 600;
}
.auth-footer a:hover {
text-decoration: underline;
}
.error-message {
background: #ffebee;
border-left: 4px solid #f44336;
padding: 12px 16px;
margin-bottom: 20px;
border-radius: 4px;
color: #c62828;
font-size: 14px;
display: none;
}
.success-message {
background: #e8f5e9;
border-left: 4px solid #4caf50;
padding: 12px 16px;
margin-bottom: 20px;
border-radius: 4px;
color: #2e7d32;
font-size: 14px;
display: none;
}
.loading-spinner {
display: inline-block;
width: 16px;
height: 16px;
border: 2px solid #ffffff;
border-radius: 50%;
border-top-color: transparent;
animation: spin 0.8s linear infinite;
margin-right: 8px;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div style="position: absolute; top: 20px; right: 20px;">
<button id="themeToggle" class="theme-toggle" aria-label="Toggle Theme">
<i class="fas fa-moon"></i>
</button>
</div>
<div class="auth-container">
<div class="auth-header">
<h1>🎤 Create Account</h1>
<p>Join us to detect AI-generated voices</p>
</div>
<div id="errorMessage" class="error-message"></div>
<div id="successMessage" class="success-message"></div>
<form id="registerForm">
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" placeholder="your@email.com" required autocomplete="email">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Min 8 characters" required
autocomplete="new-password" minlength="8">
</div>
<button type="submit" class="btn-primary" id="registerBtn">
Create Account
</button>
</form>
<div class="auth-footer">
Already have an account? <a href="login.html">Login</a>
</div>
</div>
<script>
const API_URL = '';
const registerForm = document.getElementById('registerForm');
const registerBtn = document.getElementById('registerBtn');
const errorMessage = document.getElementById('errorMessage');
const successMessage = document.getElementById('successMessage');
registerForm.addEventListener('submit', async (e) => {
e.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
// Hide previous messages
errorMessage.style.display = 'none';
successMessage.style.display = 'none';
// Disable button and show loading
registerBtn.disabled = true;
registerBtn.innerHTML = '<span class="loading-spinner"></span>Creating account...';
try {
const url = `${API_URL}auth/register`;
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ email, password })
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message || data.detail?.message || 'Registration failed');
}
// Store token and user info
localStorage.setItem('access_token', data.access_token);
localStorage.setItem('user_email', data.user_email);
localStorage.setItem('api_key', data.api_key);
// Show success message
successMessage.textContent = 'Account created successfully! Redirecting...';
successMessage.style.display = 'block';
// Redirect to dashboard
setTimeout(() => {
window.location.href = 'dashboard.html';
}, 1500);
} catch (error) {
console.error('Registration error:', error);
errorMessage.textContent = error.message;
errorMessage.style.display = 'block';
// Re-enable button
registerBtn.disabled = false;
registerBtn.innerHTML = 'Create Account';
}
});
</script>
<!-- Team Footer -->
<footer class="team-footer">
<div class="footer-divider"></div>
<div class="footer-content">
<h2 class="team-name">Bug Hunterx</h2>
<h3>Built by</h3>
<div class="team-members">
<div class="member">
<span class="name">Mohammed Meraj Uddin</span>
<a href="https://www.linkedin.com/in/merajuddin-0751a6396" target="_blank"
aria-label="LinkedIn for Mohammed Meraj Uddin">
<i class="fab fa-linkedin"></i>
</a>
</div>
<div class="member">
<span class="name">Mohd Basheer Ahmed</span>
<a href="https://www.linkedin.com/in/mohd-basheer-ahmed-5247593a6" target="_blank"
aria-label="LinkedIn for Mohd Basheer Ahmed">
<i class="fab fa-linkedin"></i>
</a>
</div>
</div>
<p class="footer-note">Responsive UI • Optimized for all screen sizes • Build v5.3 (Live Fix)</p>
</div>
</footer>
</body>
</html>