This commit is contained in:
2024-02-04 09:26:17 +01:00
parent 69dfb64ce4
commit 8ab13c554e
3 changed files with 40 additions and 53 deletions

View File

@@ -63,53 +63,14 @@
function init(){
getUserInfo();
}
function displayUserInfo(userData) {
const tableContainer = document.getElementById("userInfoTable");
tableContainer.innerHTML = ""; // Clear previous content
const table = document.createElement("table");
table.border = "1";
const headerRow = table.insertRow(0);
for (const key in userData) {
const th = document.createElement("th");
th.appendChild(document.createTextNode(key));
headerRow.appendChild(th);
}
const dataRow = table.insertRow(1);
for (const key in userData) {
const td = document.createElement("td");
td.appendChild(document.createTextNode(userData[key]));
dataRow.appendChild(td);
}
tableContainer.appendChild(table);
}
window.onload = init();
</script>
<!-- Centralized Status Message -->
<p id="StatusMessage"></p>
<table id="userInfoTable"></table>
<div class="form-container" id="changePasswordForm">
<h1>Change Password</h1>
<form>
<label for="changeOldPassword">Old Password:</label>
<input type="password" id="changeOldPassword" name="changeOldPassword" required><br>
<label for="changeNewPassword">New Password:</label>
<input type="password" id="changeNewPassword" name="changeNewPassword" required><br>
<button type="button" onclick="changePassword()">Change Password</button>
</form><br>
</div>
<div class="form-container" id="updateUserProfileForm">
<h1>Update User Profile</h1>
<h1>Update User</h1>
<form>
<label for="updateFirstName">First Name:</label>
<input type="text" id="updateFirstName" name="updateFirstName" required><br>
@@ -124,19 +85,7 @@
<input type="text" id="updateMinecraftNick" name="updateMinecraftNick" required><br>
<button type="button" onclick="updateUserProfile()">Update Profile</button>
</form><br>
</div>
<div class="form-container" id="getUserInfoForm">
<h1>Get User Info</h1>
<form>
<button type="button" onclick="getUserInfo()">Get User Info</button>
</form><br>
</div>
<div class="form-container" id="updateUserEmailForm">
<h1>Update User Email</h1>
<form>
<label for="updateNewEmail">New Email:</label>
<input type="email" id="updateNewEmail" name="updateNewEmail" required><br>
@@ -144,4 +93,17 @@
</form><br>
</div>
<div class="form-container" id="changePasswordForm">
<h1>Change Password</h1>
<form>
<label for="changeOldPassword">Old Password:</label>
<input type="password" id="changeOldPassword" name="changeOldPassword" required><br>
<label for="changeNewPassword">New Password:</label>
<input type="password" id="changeNewPassword" name="changeNewPassword" required><br>
<button type="button" onclick="changePassword()">Change Password</button>
</form><br>
</div>
<button type="button" onclick="logout()">Logout</button><br>