Files
Reload-Backend/Website/Data/html/register.html
T
2024-08-12 04:38:12 +02:00

85 lines
3.3 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</title>
<link rel="stylesheet" href="/css/styles.css">
<link rel="icon" href="/Images/reload.ico" type="image/x-icon">
</head>
<body class="dark-theme">
<div class="register-container">
<h1>REGISTER</h1>
<form id="registerForm">
<div class="input-container">
<input type="text" id="username" placeholder="Username" required>
</div>
<div class="input-container">
<input type="email" id="email" placeholder="Email" required>
</div>
<div class="input-container">
<input type="password" id="password" placeholder="Password" required>
<span class="toggle-password" onclick="togglePasswordVisibility()">👁️</span>
</div>
<input type="submit" value="Create Your Account">
</form>
</div>
<button class="theme-toggle" id="themeToggle"></button>
<footer style="position: fixed; bottom: 0; width: 100%; text-align: center; color: gray; font-size: 14px; padding: 10px;">
Powered by Reload Backend - © 2024
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
const params = new URLSearchParams(window.location.search);
const discordId = params.get('discordId');
const username = params.get('username');
if (username) {
document.getElementById('username').value = username;
}
document.getElementById('registerForm').addEventListener('submit', function(event) {
event.preventDefault();
const username = document.getElementById('username').value;
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
fetch('/register-user', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ discordId, username, email, password })
}).then(response => response.json())
.then(data => {
alert(data.message);
if (data.success) {
window.location.href = '/';
}
}).catch(error => console.error('Error:', error));
});
const themeToggle = document.getElementById('themeToggle');
themeToggle.addEventListener('click', () => {
document.body.classList.toggle('light-theme');
document.body.classList.toggle('dark-theme');
});
});
function togglePasswordVisibility() {
const passwordInput = document.getElementById('password');
const eyeIcon = document.querySelector('.toggle-password');
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
eyeIcon.textContent = '🙈';
} else {
passwordInput.type = 'password';
eyeIcon.textContent = '👁️';
}
}
</script>
</body>
</html>