Merge register and login into one
This commit is contained in:
parent
e3901499cd
commit
5c2d906fb0
@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
function login() {
|
function login() {
|
||||||
const email = document.getElementById("email").value;
|
const email = document.getElementById("login_email").value;
|
||||||
const password = document.getElementById("password").value;
|
const password = document.getElementById("login_password").value;
|
||||||
doLogin(email, password);
|
doLogin(email, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,20 +13,75 @@
|
|||||||
|
|
||||||
doAccountAction(data, "Login Successful!", "Login failed. Please check your credentials.");
|
doAccountAction(data, "Login Successful!", "Login failed. Please check your credentials.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function register() {
|
||||||
|
const firstName = document.getElementById("register_firstName").value;
|
||||||
|
const lastName = document.getElementById("register_lastName").value;
|
||||||
|
const nickname = document.getElementById("register_nickname").value;
|
||||||
|
const email = document.getElementById("register_email").value;
|
||||||
|
const password = document.getElementById("register_password").value;
|
||||||
|
const minecraftNick = document.getElementById("register_minecraftNick").value;
|
||||||
|
const activationToken = document.getElementById("register_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>
|
</script>
|
||||||
|
|
||||||
|
<!-- Centralized Status Message -->
|
||||||
|
<p id="StatusMessage"></p>
|
||||||
|
|
||||||
<div class="form-container" id="loginForm">
|
<div class="form-container" id="loginForm">
|
||||||
<h1>Login</h1>
|
<h1>Login</h1>
|
||||||
<form>
|
<form>
|
||||||
<label for="email">Email:</label>
|
<label for="login_email">Email:</label>
|
||||||
<input type="text" id="email" name="email" required>
|
<input type="text" id="login_email" name="email" required><br>
|
||||||
|
|
||||||
<label for="password">Password:</label>
|
<label for="login_password">Password:</label>
|
||||||
<input type="password" id="password" name="password" required>
|
<input type="password" id="login_password" name="password" required><br>
|
||||||
|
|
||||||
<button type="button" onclick="login()">Login</button>
|
<button type="button" onclick="login()">Login</button>
|
||||||
</form>
|
</form><hr>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Centralized Status Message -->
|
<div class="form-container" id="register_Form">
|
||||||
<p id="StatusMessage"></p>
|
<h1>Register</h1>
|
||||||
|
<form>
|
||||||
|
<label for="register_firstName">First Name:</label>
|
||||||
|
<input type="text" id="register_firstName" name="firstName" required><br>
|
||||||
|
|
||||||
|
<label for="register_lastName">Last Name:</label>
|
||||||
|
<input type="text" id="register_lastName" name="lastName" required><br>
|
||||||
|
|
||||||
|
<label for="register_nickname">Nickname:</label>
|
||||||
|
<input type="text" id="register_nickname" name="nickname" required><br>
|
||||||
|
|
||||||
|
<label for="register_email">Email:</label>
|
||||||
|
<input type="text" id="register_email" name="email" required><br>
|
||||||
|
|
||||||
|
<label for="register_password">Password:</label>
|
||||||
|
<input type="password" id="register_password" name="password" required><br>
|
||||||
|
|
||||||
|
<label for="register_minecraftNick">Minecraft Nick:</label>
|
||||||
|
<input type="text" id="register_minecraftNick" name="minecraftNick" required><br>
|
||||||
|
|
||||||
|
<label for="register_activationToken">Activation Token:</label>
|
||||||
|
<input type="text" id="register_activationToken" name="activationToken" required><br>
|
||||||
|
|
||||||
|
<button type="button" onclick="register()">Register</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
@ -1,58 +0,0 @@
|
|||||||
<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>
|
|
Loading…
Reference in New Issue
Block a user