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

@ -28,6 +28,18 @@ function handleResponse(data, SuccessMessage, failureMessage) {
} else {
StatusMessageElement.innerText = failureMessage;
}
// Show the status message
StatusMessageElement.style.display = "block";
setTimeout(() => {
// Hide the status message after 3 seconds
StatusMessageElement.style.opacity = 0;
setTimeout(() => {
StatusMessageElement.style.display = "none";
// Reset opacity for future messages
StatusMessageElement.style.opacity = 1;
}, 500);
}, 3000);
}
function logout() {

@ -211,6 +211,20 @@ header ul li {
margin-left: 20px;
}
#StatusMessage {
display: none;
position: fixed;
top: 20px;
right: 20px;
padding: 10px;
background-color: var(--third-bg);
color: var(--primary-text);
border-radius: 5px;
opacity: 0;
transition: opacity 0.5s ease-in-out;
}
/* <DASHBOARD STYLING> */
/* ZAČÍNAJ VŠETKO S ".dashboard" */
@ -221,5 +235,4 @@ header ul li {
text-align: center;
}
/* </DASHBOARD STYLING> */

@ -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>