implement authentication and authorization

This commit is contained in:
Yuri
2026-01-01 15:36:38 -05:00
parent 46c68813ec
commit e1a197f2be
16 changed files with 1704 additions and 2 deletions
+14
View File
@@ -0,0 +1,14 @@
document.getElementById('login-form').addEventListener('submit', async (e) => {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
try {
const response = await API.request('POST', '/auth/login', { username, password });
localStorage.setItem('sessionToken', response.token);
window.location.href = '/';
} catch (err) {
document.getElementById('login-error').textContent = 'Login failed: ' + err.message;
}
});