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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="ro">
|
| 3 |
+
<head>
|
| 4 |
+
<link rel="icon" type="image/svg+xml" href="favicon.svg">
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
| 7 |
+
<title>SGE | Login</title>
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
<script src="errors.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
body { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:100dvh; padding:20px 14px; }
|
| 12 |
+
|
| 13 |
+
/* Loader overlay pentru login */
|
| 14 |
+
#login-loader { background:var(--black); }
|
| 15 |
+
|
| 16 |
+
/* Role fields animatie */
|
| 17 |
+
.role-fields-wrap { position:relative; min-height:200px; }
|
| 18 |
+
.fields { position:absolute; inset:0; padding:20px 16px; }
|
| 19 |
+
.fields.current { position:relative; }
|
| 20 |
+
</style>
|
| 21 |
+
<script>// Verificat dupa auth - se face in JS</script>
|
| 22 |
+
</head>
|
| 23 |
+
<body>
|
| 24 |
+
|
| 25 |
+
<!-- LOADER -->
|
| 26 |
+
<div class="loader-overlay" id="login-loader">
|
| 27 |
+
<div class="loader">
|
| 28 |
+
<div class="inner one"></div>
|
| 29 |
+
<div class="inner two"></div>
|
| 30 |
+
<div class="inner three"></div>
|
| 31 |
+
</div>
|
| 32 |
+
<div class="loader-text" id="loader-text">INIȚIALIZARE</div>
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<div class="login-wrap" id="login-wrap" style="opacity:0">
|
| 36 |
+
|
| 37 |
+
<div class="login-header fade-in">
|
| 38 |
+
<img src="logo.svg" alt="SGE">
|
| 39 |
+
<h1>SGE</h1>
|
| 40 |
+
<p>Sistem de Gestiune Educațională</p>
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
<div class="server-status fade-in-2">
|
| 44 |
+
<span class="status-dot online"></span>
|
| 45 |
+
<span>SERVER ACTIV · 93.117.161.226</span>
|
| 46 |
+
</div>
|
| 47 |
+
|
| 48 |
+
<div class="fade-in-3">
|
| 49 |
+
<!-- Role tabs -->
|
| 50 |
+
<div class="role-tabs">
|
| 51 |
+
<button class="role-tab active" id="tab-elev" onclick="switchRole('elev',this)">
|
| 52 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="12" cy="7" r="4"/><path d="M4 21c0-4 3.58-7 8-7s8 3 8 7"/></svg>
|
| 53 |
+
ELEV
|
| 54 |
+
</button>
|
| 55 |
+
<button class="role-tab" id="tab-profesor" onclick="switchRole('profesor',this)">
|
| 56 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="3" y="3" width="18" height="13" rx="1"/><path d="M8 21h8M12 16v5"/></svg>
|
| 57 |
+
PROFESOR
|
| 58 |
+
</button>
|
| 59 |
+
<button class="role-tab" id="tab-admin" onclick="switchRole('admin',this)">
|
| 60 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>
|
| 61 |
+
ADMIN
|
| 62 |
+
</button>
|
| 63 |
+
</div>
|
| 64 |
+
|
| 65 |
+
<!-- Fields wrapper -->
|
| 66 |
+
<div class="role-fields-wrap" id="fields-wrap">
|
| 67 |
+
|
| 68 |
+
<!-- ELEV -->
|
| 69 |
+
<div class="fields current show" id="f-elev" style="padding:20px 16px;border:1px solid var(--glass-border);border-top:none;">
|
| 70 |
+
<div class="field">
|
| 71 |
+
<label>Identificator Elev</label>
|
| 72 |
+
<select id="elev-id" onchange="checkElevPin()">
|
| 73 |
+
<option value="">— selectează —</option>
|
| 74 |
+
</select>
|
| 75 |
+
</div>
|
| 76 |
+
<div id="pin-field" class="field" style="display:none;">
|
| 77 |
+
<label>Cod VPass</label>
|
| 78 |
+
<input type="password" id="elev-pin" maxlength="6" placeholder="——————" inputmode="numeric" autocomplete="current-password">
|
| 79 |
+
</div>
|
| 80 |
+
<div id="btn-login-wrap" style="margin-top:14px;display:none;">
|
| 81 |
+
<button class="btn-primary" style="width:100%;letter-spacing:3px;" onclick="doLogin()">AUTENTIFICARE</button>
|
| 82 |
+
</div>
|
| 83 |
+
<button class="btn-signup" id="btn-signup" onclick="goSignup()">ÎNREGISTRARE →</button>
|
| 84 |
+
<div class="signup-hint" id="signup-hint">Contul tău nu are încă o parolă.<br>Apasă ÎNREGISTRARE pentru a-l activa.</div>
|
| 85 |
+
<div style="text-align:center;margin-top:12px;display:none;" id="reset-link-wrap">
|
| 86 |
+
<a href="reset.html" style="font-size:9px;color:var(--white-dim);letter-spacing:1px;text-decoration:none;">Am uitat parola →</a>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
<!-- PROFESOR -->
|
| 91 |
+
<div class="fields" id="f-profesor" style="padding:20px 16px;border:1px solid var(--glass-border);border-top:none;">
|
| 92 |
+
<div class="field">
|
| 93 |
+
<label>Identificator Profesor</label>
|
| 94 |
+
<select id="prof-id"><option value="">— selectează —</option></select>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="field">
|
| 97 |
+
<label>Cod de Acces</label>
|
| 98 |
+
<input type="password" id="prof-pin" maxlength="6" placeholder="——————" inputmode="numeric">
|
| 99 |
+
</div>
|
| 100 |
+
<div style="margin-top:14px;">
|
| 101 |
+
<button class="btn-primary" style="width:100%;letter-spacing:3px;" onclick="doLogin()">AUTENTIFICARE</button>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
|
| 105 |
+
<!-- ADMIN -->
|
| 106 |
+
<div class="fields" id="f-admin" style="padding:20px 16px;border:1px solid var(--glass-border);border-top:none;">
|
| 107 |
+
<div class="field">
|
| 108 |
+
<label>Parolă Administrator</label>
|
| 109 |
+
<input type="password" id="admin-pass" placeholder="—————————————" autocomplete="off">
|
| 110 |
+
</div>
|
| 111 |
+
<div style="margin-top:14px;">
|
| 112 |
+
<button class="btn-primary" style="width:100%;letter-spacing:3px;" onclick="doLogin()">AUTENTIFICARE</button>
|
| 113 |
+
</div>
|
| 114 |
+
<div style="margin-top:10px;font-size:9px;color:var(--white-faint);letter-spacing:1px;text-align:center;">
|
| 115 |
+
Sesiunea admin nu este persistentă
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
</div>
|
| 120 |
+
|
| 121 |
+
<div class="alert error" id="err-msg" style="margin-top:10px;border-top:none;"></div>
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<div class="footer-mini fade-in-4">
|
| 125 |
+
SGE ©2026 — Victor Roșca<br>
|
| 126 |
+
Telenești, Moldova
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<script type="module">
|
| 131 |
+
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.0/firebase-app.js";
|
| 132 |
+
import { getFirestore, collection, getDocs, doc, getDoc }
|
| 133 |
+
from "https://www.gstatic.com/firebasejs/10.12.0/firebase-firestore.js";
|
| 134 |
+
|
| 135 |
+
const cfg = {
|
| 136 |
+
apiKey:"AIzaSyB9--Onx3-_YjD-YzblhZjaWSVVqTQJ1lU",
|
| 137 |
+
authDomain:"vservers1.firebaseapp.com", projectId:"vservers1",
|
| 138 |
+
storageBucket:"vservers1.firebasestorage.app",
|
| 139 |
+
messagingSenderId:"42433037358", appId:"1:42433037358:web:fde70fec79542428b60bbf"
|
| 140 |
+
};
|
| 141 |
+
const app = initializeApp(cfg);
|
| 142 |
+
const db = getFirestore(app);
|
| 143 |
+
window._db=db; window._doc=doc; window._getDoc=getDoc;
|
| 144 |
+
|
| 145 |
+
// ── Verifica sesiune persistenta ──
|
| 146 |
+
const role = sessionStorage.getItem('vs_role');
|
| 147 |
+
if (role === 'elev') {
|
| 148 |
+
if(localStorage.getItem('sge_maintenance')==='1'){window.location.href='503.html';}else{window.location.href='elev-dashboard.html';}
|
| 149 |
+
} else if (role === 'profesor') {
|
| 150 |
+
if(localStorage.getItem('sge_maintenance')==='1'){window.location.href='503.html';}else{window.location.href='profesor-dashboard.html';}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
// ── Loader sequence ──
|
| 154 |
+
const loaderTexts = ['INIȚIALIZARE','FIREBASE','ELEVI','GATA'];
|
| 155 |
+
let li = 0;
|
| 156 |
+
const ltEl = document.getElementById('loader-text');
|
| 157 |
+
const ltIv = setInterval(()=>{ li++; if(li<loaderTexts.length) ltEl.textContent=loaderTexts[li]; },350);
|
| 158 |
+
|
| 159 |
+
window._elevMap = {};
|
| 160 |
+
|
| 161 |
+
try {
|
| 162 |
+
const snap = await getDocs(collection(db,'elevi'));
|
| 163 |
+
const sel = document.getElementById('elev-id');
|
| 164 |
+
const elevi = [];
|
| 165 |
+
snap.forEach(d => {
|
| 166 |
+
elevi.push({id:d.id,...d.data()});
|
| 167 |
+
window._elevMap[d.id] = d.data();
|
| 168 |
+
});
|
| 169 |
+
elevi.sort((a,b)=>(a.pozitie||0)-(b.pozitie||0));
|
| 170 |
+
elevi.forEach(e => {
|
| 171 |
+
const o = document.createElement('option');
|
| 172 |
+
o.value = e.id;
|
| 173 |
+
o.textContent = `${String(e.pozitie||'').padStart(2,'0')}. ${e.nume}`;
|
| 174 |
+
sel.appendChild(o);
|
| 175 |
+
});
|
| 176 |
+
} catch(e) { console.error('err-001',e); }
|
| 177 |
+
|
| 178 |
+
try {
|
| 179 |
+
const snap = await getDocs(collection(db,'profesori'));
|
| 180 |
+
const sel = document.getElementById('prof-id');
|
| 181 |
+
snap.forEach(d => {
|
| 182 |
+
const o = document.createElement('option');
|
| 183 |
+
o.value = d.id;
|
| 184 |
+
o.textContent = `${d.data().nume} — ${d.data().materie||''}`;
|
| 185 |
+
sel.appendChild(o);
|
| 186 |
+
});
|
| 187 |
+
} catch(e) {}
|
| 188 |
+
|
| 189 |
+
// ── Hide loader ──
|
| 190 |
+
clearInterval(ltIv);
|
| 191 |
+
await new Promise(r=>setTimeout(r,400));
|
| 192 |
+
document.getElementById('login-loader').classList.add('hide');
|
| 193 |
+
document.getElementById('login-wrap').style.opacity='1';
|
| 194 |
+
document.getElementById('login-wrap').style.transition='opacity 0.4s ease';
|
| 195 |
+
</script>
|
| 196 |
+
|
| 197 |
+
<script>
|
| 198 |
+
let role = 'elev';
|
| 199 |
+
const ADMIN_PASS = '122012';
|
| 200 |
+
let _switching = false;
|
| 201 |
+
|
| 202 |
+
function switchRole(r, btn) {
|
| 203 |
+
if (_switching || r === role) return;
|
| 204 |
+
_switching = true;
|
| 205 |
+
|
| 206 |
+
const currentEl = document.getElementById('f-' + role);
|
| 207 |
+
const nextEl = document.getElementById('f-' + r);
|
| 208 |
+
|
| 209 |
+
// Update tab imediat
|
| 210 |
+
document.querySelectorAll('.role-tab').forEach(b => b.classList.remove('active'));
|
| 211 |
+
btn.classList.add('active');
|
| 212 |
+
hideError('err-msg');
|
| 213 |
+
|
| 214 |
+
// Fade OUT curent
|
| 215 |
+
currentEl.style.transition = 'opacity 0.35s ease, transform 0.35s ease';
|
| 216 |
+
currentEl.style.opacity = '0';
|
| 217 |
+
currentEl.style.transform = 'translateY(-8px)';
|
| 218 |
+
|
| 219 |
+
// După 0.2s apare următorul
|
| 220 |
+
setTimeout(() => {
|
| 221 |
+
currentEl.classList.remove('show');
|
| 222 |
+
currentEl.style.opacity = '';
|
| 223 |
+
currentEl.style.transform = '';
|
| 224 |
+
currentEl.style.transition= '';
|
| 225 |
+
|
| 226 |
+
nextEl.style.opacity = '0';
|
| 227 |
+
nextEl.style.transform = 'translateY(10px)';
|
| 228 |
+
nextEl.style.transition = 'none';
|
| 229 |
+
nextEl.classList.add('show');
|
| 230 |
+
|
| 231 |
+
requestAnimationFrame(() => {
|
| 232 |
+
requestAnimationFrame(() => {
|
| 233 |
+
nextEl.style.transition = 'opacity 0.4s ease, transform 0.4s ease';
|
| 234 |
+
nextEl.style.opacity = '1';
|
| 235 |
+
nextEl.style.transform = 'translateY(0)';
|
| 236 |
+
});
|
| 237 |
+
});
|
| 238 |
+
|
| 239 |
+
role = r;
|
| 240 |
+
setTimeout(() => {
|
| 241 |
+
nextEl.style.transition = '';
|
| 242 |
+
_switching = false;
|
| 243 |
+
}, 450);
|
| 244 |
+
}, 1500);
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
function checkElevPin() {
|
| 248 |
+
const id = document.getElementById('elev-id').value;
|
| 249 |
+
const elev = window._elevMap && window._elevMap[id];
|
| 250 |
+
const hasPin = elev && elev.pin != null;
|
| 251 |
+
|
| 252 |
+
document.getElementById('pin-field').style.display = hasPin ? 'block' : 'none';
|
| 253 |
+
document.getElementById('btn-login-wrap').style.display = hasPin ? 'block' : 'none';
|
| 254 |
+
document.getElementById('btn-signup').classList.toggle('show', !hasPin && !!id);
|
| 255 |
+
document.getElementById('signup-hint').classList.toggle('show', !hasPin && !!id);
|
| 256 |
+
document.getElementById('reset-link-wrap').style.display = hasPin ? 'block' : 'none';
|
| 257 |
+
hideError('err-msg');
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
function goSignup() {
|
| 261 |
+
const id = document.getElementById('elev-id').value;
|
| 262 |
+
const elev = window._elevMap && window._elevMap[id];
|
| 263 |
+
if (!id || !elev) { showError('err-msg','err-002'); return; }
|
| 264 |
+
sessionStorage.setItem('su_elevId', id);
|
| 265 |
+
sessionStorage.setItem('su_name', elev.nume);
|
| 266 |
+
sessionStorage.setItem('su_vpass', elev.vpassId);
|
| 267 |
+
window.location.href = 'signup.html';
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
async function doLogin() {
|
| 271 |
+
hideError('err-msg');
|
| 272 |
+
|
| 273 |
+
// Show loader
|
| 274 |
+
const loader = document.getElementById('login-loader');
|
| 275 |
+
loader.classList.remove('hide');
|
| 276 |
+
loader.style.opacity = '1';
|
| 277 |
+
loader.style.visibility = 'visible';
|
| 278 |
+
document.getElementById('loader-text').textContent = 'AUTENTIFICARE';
|
| 279 |
+
|
| 280 |
+
await delay(300);
|
| 281 |
+
|
| 282 |
+
try {
|
| 283 |
+
if (role === 'elev') {
|
| 284 |
+
const id = document.getElementById('elev-id').value;
|
| 285 |
+
const pin = document.getElementById('elev-pin').value;
|
| 286 |
+
if (!id) { showError('err-msg','err-002'); return; }
|
| 287 |
+
if (pin.length < 6) { showError('err-msg','err-022'); return; }
|
| 288 |
+
const snap = await window._getDoc(window._doc(window._db,'elevi',id));
|
| 289 |
+
if (!snap.exists()) { showError('err-msg','err-002'); return; }
|
| 290 |
+
const data = snap.data();
|
| 291 |
+
if (data.pin == null) { showError('err-msg','err-004'); return; }
|
| 292 |
+
if (data.pin !== pin) {
|
| 293 |
+
showError('err-msg','err-003');
|
| 294 |
+
fetch('/api/log',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({tip:'err_pass',vpass:data.vpassId||id,role:'elev'})}).catch(()=>{});
|
| 295 |
+
return;
|
| 296 |
+
}
|
| 297 |
+
// Sesiune persistenta pentru elevi
|
| 298 |
+
sessionStorage.setItem('vs_role','elev');
|
| 299 |
+
sessionStorage.setItem('vs_uid', id);
|
| 300 |
+
sessionStorage.setItem('vs_name', data.nume);
|
| 301 |
+
sessionStorage.setItem('vs_vpass', data.vpassId||id);
|
| 302 |
+
fetch('/api/log',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({tip:'login',vpass:data.vpassId||id,name:data.nume,role:'elev'})}).catch(()=>{});
|
| 303 |
+
document.getElementById('loader-text').textContent = 'ACCES ACORDAT';
|
| 304 |
+
await delay(400);
|
| 305 |
+
window.location.href = 'elev-dashboard.html';
|
| 306 |
+
|
| 307 |
+
} else if (role === 'profesor') {
|
| 308 |
+
const id = document.getElementById('prof-id').value;
|
| 309 |
+
const pin = document.getElementById('prof-pin').value;
|
| 310 |
+
if (!id) { showError('err-msg','err-002'); return; }
|
| 311 |
+
if (pin.length < 6) { showError('err-msg','err-022'); return; }
|
| 312 |
+
const snap = await window._getDoc(window._doc(window._db,'profesori',id));
|
| 313 |
+
if (!snap.exists() || snap.data().pin !== pin) {
|
| 314 |
+
showError('err-msg','err-003');
|
| 315 |
+
fetch('/api/log',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({tip:'err_pass',vpass:id,role:'profesor'})}).catch(()=>{});
|
| 316 |
+
return;
|
| 317 |
+
}
|
| 318 |
+
// Sesiune persistenta pentru profesori
|
| 319 |
+
sessionStorage.setItem('vs_role','profesor');
|
| 320 |
+
sessionStorage.setItem('vs_uid', id);
|
| 321 |
+
sessionStorage.setItem('vs_name', snap.data().nume);
|
| 322 |
+
sessionStorage.setItem('vs_materie', snap.data().materie||'');
|
| 323 |
+
fetch('/api/log',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({tip:'login',vpass:id,name:snap.data().nume,role:'profesor'})}).catch(()=>{});
|
| 324 |
+
document.getElementById('loader-text').textContent = 'ACCES ACORDAT';
|
| 325 |
+
await delay(400);
|
| 326 |
+
if(localStorage.getItem('sge_maintenance')==='1'){window.location.href='503.html';}else{window.location.href='profesor-dashboard.html';}
|
| 327 |
+
|
| 328 |
+
} else {
|
| 329 |
+
// ADMIN — fara sesiune persistenta (sessionStorage doar)
|
| 330 |
+
if (document.getElementById('admin-pass').value !== ADMIN_PASS) {
|
| 331 |
+
showError('err-msg','err-020'); return;
|
| 332 |
+
}
|
| 333 |
+
sessionStorage.setItem('vs_role','admin');
|
| 334 |
+
document.getElementById('loader-text').textContent = 'ACCES ACORDAT';
|
| 335 |
+
await delay(400);
|
| 336 |
+
window.location.href = 'admin-dashboard.html';
|
| 337 |
+
}
|
| 338 |
+
} catch(e) {
|
| 339 |
+
showError('err-msg','err-001');
|
| 340 |
+
} finally {
|
| 341 |
+
loader.classList.add('hide');
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// Enter key support
|
| 346 |
+
document.addEventListener('keydown', e => {
|
| 347 |
+
if (e.key === 'Enter') doLogin();
|
| 348 |
+
});
|
| 349 |
+
|
| 350 |
+
function delay(ms) { return new Promise(r=>setTimeout(r,ms)); }
|
| 351 |
+
</script>
|
| 352 |
+
<a href="vhelp.html" class="vhelp-fab" title="VHelp">
|
| 353 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.9)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
| 354 |
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
| 355 |
+
<circle cx="9" cy="10" r="0.5" fill="rgba(255,255,255,0.9)"/>
|
| 356 |
+
<circle cx="12" cy="10" r="0.5" fill="rgba(255,255,255,0.9)"/>
|
| 357 |
+
<circle cx="15" cy="10" r="0.5" fill="rgba(255,255,255,0.9)"/>
|
| 358 |
+
</svg>
|
| 359 |
+
</a>
|
| 360 |
+
</body>
|
| 361 |
+
</html>
|