Ajuste de cadastro/gerenciamento de usuarios e seguranca de endpoints
continuous-integration/webhook Falha no deploy (rx.scoreodonto.com)

This commit is contained in:
VPS 4 Builder
2026-05-26 20:48:21 +02:00
parent da40ab11f6
commit dc1801f4a7
7 changed files with 104 additions and 24 deletions
+33 -2
View File
@@ -287,8 +287,25 @@
}
async function loadClients() {
const token = localStorage.getItem('auth_token') || '';
try {
const response = await fetch('/api/socket/status');
const response = await fetch('/api/socket/status', {
headers: {
'Authorization': `Bearer ${token}`
}
});
if (response.status === 401) {
localStorage.removeItem('auth_token');
window.location.href = '/login';
return;
}
if (response.status === 403) {
alert('Acesso negado. Esta área é restrita a administradores.');
window.location.href = '/';
return;
}
const data = await response.json();
// Atualizar stats
@@ -404,6 +421,8 @@
testBtn.disabled = true;
testBtn.innerHTML = '<span class="loading"></span> Testando...';
const token = localStorage.getItem('auth_token') || '';
try {
// Limpar resultados anteriores
testResults = {};
@@ -413,10 +432,22 @@
const response = await fetch('/api/socket/test-connection', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
if (response.status === 401) {
localStorage.removeItem('auth_token');
window.location.href = '/login';
return;
}
if (response.status === 403) {
alert('Acesso negado. Esta área é restrita a administradores.');
window.location.href = '/';
return;
}
const result = await response.json();
// Processar resultados