Implement session-based authentication and add logout functionality

Fix #15
This commit is contained in:
2025-01-24 22:02:54 +01:00
parent da2f568acf
commit 23a39247a1
6 changed files with 104 additions and 12 deletions

View File

@@ -17,11 +17,15 @@ document.addEventListener('DOMContentLoaded', function() {
const loginMessage = document.getElementById('loginMessage');
// Check if user is already logged in
if (sessionStorage.getItem('loggedIn') === 'true') {
loginContainer.style.display = 'none';
appContainer.style.display = 'block';
loadTags();
}
fetch('/check-session')
.then(response => response.json())
.then(data => {
if (data.loggedIn) {
loginContainer.style.display = 'none';
appContainer.style.display = 'block';
loadTags();
}
});
loginForm.addEventListener('submit', function(e) {
e.preventDefault();