<script>
    function register() {
        const firstName = document.getElementById("firstName").value;
        const lastName = document.getElementById("lastName").value;
        const nickname = document.getElementById("nickname").value;
        const email = document.getElementById("email").value;
        const password = document.getElementById("password").value;
        const minecraftNick = document.getElementById("minecraftNick").value;
        const activationToken = document.getElementById("activationToken").value;

        const data = new URLSearchParams();
        data.append("action", "register");
        data.append("firstname", firstName);
        data.append("lastname", lastName);
        data.append("nickname", nickname);
        data.append("email", email);
        data.append("password", password);
        data.append("minecraft_nick", minecraftNick);
        data.append("activation_token", activationToken);

        doRegister(data);
    }

    function doRegister(requestData) {
        doAccountAction(requestData, "Registration Successful!", "Registration failed.");
    }
</script>

<div class="form-container" id="registerForm">
    <h1>Register</h1>
    <form>
        <label for="firstName">First Name:</label>
        <input type="text" id="firstName" name="firstName" required>

        <label for="lastName">Last Name:</label>
        <input type="text" id="lastName" name="lastName" required>

        <label for="nickname">Nickname:</label>
        <input type="text" id="nickname" name="nickname" required>

        <label for="email">Email:</label>
        <input type="text" id="email" name="email" required>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required>

        <label for="minecraftNick">Minecraft Nick:</label>
        <input type="text" id="minecraftNick" name="minecraftNick" required>

        <label for="activationToken">Activation Token:</label>
        <input type="text" id="activationToken" name="activationToken" required>

        <button type="button" onclick="register()">Register</button>
    </form>
</div>

<!-- Centralized Status Message -->
<p id="StatusMessage"></p>