Implement session-based authentication and add logout functionality
Fix #15
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user