diff --git a/index.html b/index.html index 595eeb3..49fc1fb 100644 --- a/index.html +++ b/index.html @@ -68,7 +68,6 @@ document.getElementById('lb').onclick=function(){ var SBU="https://znexbjafkvyjffffbhlf.supabase.co",SBK="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InpuZXhiamFma3Z5amZmZmZiaGxmIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc4MDY0NDE4MiwiZXhwIjoyMDk2MjIwMTgyfQ.5pOYTkL5eCmpSHBY3EwKof6NVKt7tL4Fn8xUAKM8itE"; fetch(SBU+"/rest/v1/users?login=eq."+encodeURIComponent(u),{headers:{"apikey":SBK,"Authorization":"Bearer "+SBK}}).then(function(r){return r.json()}).then(function(d){if(d.length>0&&d[0].pass===p){var ud=d[0];doAppLogin(u,ud);users[u]={pass:ud.pass,name:ud.name,email:ud.email,role:ud.role,freq:ud.freq,branch:ud.branch,dept:ud.dept,region:ud.region,oblast:ud.oblast,city:ud.city};localStorage.setItem('pab_users',JSON.stringify(users))}else{btn.textContent='Войти';btn.disabled=false;document.getElementById('lerr').style.display='block'}}).catch(function(){btn.textContent='Войти';btn.disabled=false;document.getElementById('lerr').style.display='block'}); }; -}; document.getElementById('lp').onkeydown=function(e){if(e.key==='Enter')document.getElementById('lb').onclick()}; document.getElementById('rbb').onclick=function(){ var l=document.getElementById('rl').value.trim().toLowerCase(),p=document.getElementById('rp').value.trim(),n=document.getElementById('rn').value.trim(),em=document.getElementById('re').value.trim(),r=document.getElementById('rr').value,fr=document.getElementById('rf').value,br=document.getElementById('rb').value.trim(),dp=document.getElementById('rd').value.trim(),rg=document.getElementById('rg').value.trim(),ob=document.getElementById('ro').value.trim(),ct=document.getElementById('rc').value.trim(); @@ -83,17 +82,6 @@ document.getElementById('testBtn').onclick=function(){ fetch("https://znexbjafkvyjffffbhlf.supabase.co/rest/v1/users?select=login",{headers:{"apikey":SBK,"Authorization":"Bearer "+SBK}}).then(function(r){return r.json()}).then(function(d){if(Array.isArray(d))alert("✅ Supabase работает!\nПользователей: "+d.length+"\nЛогины: "+d.map(function(x){return x.login}).join(", "));else alert("❌ Ошибка: "+JSON.stringify(d))}).catch(function(e){alert("❌ Нет соединения: "+e)}); }; function testSupabase(){document.getElementById('testBtn').click();} -function testSupabase(){ - var SBU="https://znexbjafkvyjffffbhlf.supabase.co",SBK="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InpuZXhiamFma3Z5amZmZmZiaGxmIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc4MDY0NDE4MiwiZXhwIjoyMDk2MjIwMTgyfQ.5pOYTkL5eCmpSHBY3EwKof6NVKt7tL4Fn8xUAKM8itE"; - // Тест: получить список пользователей - fetch(SBU+"/rest/v1/users?select=login",{headers:{"apikey":SBK,"Authorization":"Bearer "+SBK}}).then(function(r){return r.json()}).then(function(d){ - if(Array.isArray(d)){ - alert("✅ Supabase работает!\nПользователей в базе: "+d.length+"\nЛогины: "+d.map(function(x){return x.login}).join(", ")); - }else{ - alert("❌ Ошибка: "+JSON.stringify(d)); - } - }).catch(function(e){alert("❌ Нет соединения с Supabase: "+e.message)}); -}