Enhance validation, logging, and UI/UX improvements

## COMMIT MESSAGE GENERATED BY COPILOT

Added JSON validation to multiple endpoints, ensuring valid JSON requests and improved error handling. Updated logging to use `DateTime.Now` and append to `logs.log` for specific actions. Enhanced `/api/accounts/login` with JSON validation and refactored for consistency.  Improved admin and user interfaces with search functionality, better date localization, and CSS adjustments. Enhanced error handling and feedback in `login.html` and `signup.html`, and improved search functionality in `archives.html`.
This commit is contained in:
whoswhip
2024-09-07 13:59:33 -04:00
parent 0e2aa78b5c
commit f02e68b1d3
10 changed files with 660 additions and 395 deletions
+24
View File
@@ -23,6 +23,7 @@
<input type="password" id="passwordInput" class="textinput" name="pasteTitle" required maxlength="50">
<button type="submit" class="button">Login</button>
</form>
<h3 id="error-message"></h3>
</div>
</div>
</body>
@@ -50,10 +51,20 @@
if (result.message != null) {
window.location.href = "/";
}
else if (result.error != null) {
const errorElement = document.getElementById("error-message");
errorElement.innerText = result.error;
errorElement.style.opacity = 1;
setTimeout(() => {
errorElement.style.opacity = 0;
}, 3000);
}
})
});
</script>
<style>
body{
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
font-weight: bold;
@@ -85,6 +96,7 @@ body{
min-height: 20%;
overflow-y: auto;
border: #222222 2px solid;
position: relative;
}
#loginForm{
display: flex;
@@ -92,6 +104,16 @@ body{
align-items: center;
width: 100%;
}
#error-message{
color: red;
opacity: 0;
position: absolute;
bottom: -0.1px;
margin-bottom: -0.1px;
top: 88%;
transition: 300ms;
}
.label{
font-size: 1.5em;
}
@@ -152,6 +174,8 @@ body{
border: #2a2a2a00 2px solid;
cursor: pointer;
font-size: 1.2em;
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
font-weight: bold;
}
.button:hover{
transition: 300ms;