security update

This commit is contained in:
2026-01-19 08:57:58 +03:00
parent 55b3d5f088
commit 5c084c6aaa
8 changed files with 182 additions and 49 deletions

View File

@@ -10,7 +10,7 @@
<script>
// Проверка авторизации при загрузке страницы
async function checkAuth() {
const response = await fetch('api/check_auth.php');
const response = await fetch('api/check_auth.php', { credentials: 'same-origin' });
const result = await response.json();
if (!result.isLoggedIn) {
@@ -23,9 +23,10 @@
}
async function logout() {
await fetch('api/logout.php');
localStorage.removeItem('user');
localStorage.removeItem('isLoggedIn');
await fetch('api/logout.php', {
method: 'POST',
credentials: 'same-origin'
});
window.location.href = 'login.html';
}