Spaces:
Running
Running
Commit History
2 days ago
-
feat(admin): one-shot bulk approve/reject + professional acceptance notification for approved users
Z UserBULK DECISIONS (owner directive 2026-12-01): the approval queue gains checkbox-per-row + select-all (up to the whole 200-row queue) and two confirm-guarded one-shot buttons. Both procedures route EVERY row through the SAME decideApproval state machine (no duplicated security logic): approve only lifts pending rows, reject skips protected admins, one bad row degrades to a skip entry instead of aborting the batch, duplicates collapse, and the batch is capped at 200 (aligned with the queue page). ACCEPTANCE NOTICE (owner directive 2026-12-01): when a user is approved they now receive a professional notification through BOTH channels that can actually reach them: 1. a dedicated bilingual acceptance email (verdict banner + one sign-in CTA, built from buildAccountApprovedEmail) riding the email_delivery_log ledger as 'approval-accepted' with one transient retry, and 2. an in-app stream event greeting them the moment they sign in. The notice rides decideApproval itself — d…264507b -
feat(admin): in-dashboard back navigation + approval-gate owner switch + AI panel icon fixes
ahmdelbaz28-uxOwner report 2026-12-01, three asks, all root-cured: 1) BACK NAVIGATION (phone back exited the whole site): Root cause: admin tabs were pure React state — the URL never changed, so tab switches pushed NO history entries and the browser back button left /admin entirely (or closed the tab when it was the landing page). Fix: tabs are now URL-synced (/admin + /admin/:tabId route). Every tab switch is a real history entry; phone back walks back through visited tabs and out to the previous page; tabs are deep-linkable (/admin/users...). New one-tap back arrow in the mobile top bar uses history when the SPA has entries and lands on the dashboard otherwise. 2) APPROVAL-GATE OWNER SWITCH (new capability, default ON): The owner can now enable/disable the whole gate from the Users tab. ON (default — the 2026-11-24 contract): registrations land pending and wait for approval. OFF: registrations approve themselves (decidedAt stamped), already-pending accounts en…0d070f3
7 days ago
-
feat(email): delivery verdicts surface in the dashboard — silent alert failures impossible
Z UserOwner report: 'the registration-approval email never reached my inbox and nothing ever told me.' Root cause: sends are best-effort and the outcome lived only in server logs the owner cannot read. - migration v22: bounded email_delivery_log ledger (class, masked recipient, ok, provider status, safe reason; 14-day prune) - email.ts: every send outcome recorded best-effort (config/network/4xx/5xx classes); network errors now a classified, ledgered failure instead of an unhandled rejection - approval.ts: alert email sends FIRST with ONE transient retry (network / 5xx only), then the in-app admin notification carries the real verdict — 'sent to your inbox' or the exact provider reason + approve-from-dashboard guidance - admin-users.ts: emailDeliveryLog query (last 10 outcomes, last approval alert, from address) — degrades to empty pre-migration - Admin.tsx: approval card shows a green/red verdict banner with the provider reason + one-click re-send, plus a mini delivery ledg…37e6657
8 days ago
-
fix(approval-gate): verified ≠ approved — the admin dashboard now shows the REAL entry state everywhere
Z UserOwner report (2026-11-26): "a user complains that despite being logged in and his email confirmed by the admin, every visit asks him to log in again — the platform does not remember him." ROOT CAUSE (code + live server logs): The admin approval gate (owner directive 2026-11-24, "لا يدخل أحد للمنصة بدون تأكيد الإيميل من الأدمن") fail-closes EVERY session issuance on users.approvalStatus === 'approved' — local login, Google OAuth callback, AND every live request (context.ts loadUserFromDb). "Email confirmation" (emailVerifiedAt — the self-service link/OTP flow) is a fully independent milestone that NEVER touches approvalStatus. The live log captured the exact victim: [GoogleAuth/OAuth] "Sign-in refused by approval gate — userId 5, gate: pending" minutes after the last deploy. The account was verified but never admin-approved → every login attempt bounces → "asks me to log in every time". The session pipeline itself (30-day sliding cookies, grace-window renewal, flag-cookie self-heal) wa…d28c7f4 -
security(audit-run1): fix all 9 confirmed findings + harden both needs_validation leads
ahmdelbaz28-uxConfirmed fixes (each with regression tests): - quiz.submit duplicate-questionId score inflation: zod refine rejects duplicates + pure deduplicating scorer (quiz-scoring.ts) + 100% clamp [M] - vision daily quota check-then-increment race: atomic reserve-then-refund (SELECT...FOR UPDATE tx + refund on every failure path) [M] - certificate grade gate passed-only denominator: average now runs over EVERY published quiz lesson (missing attempts = 0) - quiz read/submit missing course-level publish gate (join courses) - comments.list lifecycle drift (lesson+course publish joins) - last-admin guard race-to-zero-admins: conditional atomic demote (guard travels with the write; derived-table count) - yt-sync legacy body-only HMAC lane retired (STEP 2): auth extracted to unit-tested lib/yt-sync-auth.ts; requests without x-sync-ts hard-401 - push subscription cap TOCTOU: cap check + insert in one FOR UPDATE tx - Dockerfile: base image pinned to immutable digest Hardening (needs_validatio…2329257
9 days ago
-
feat(approval): reopenApproval — owner authority reaches pre-gate accounts (root fix)
ahmdelbaz28-uxOwner report (2026-11-24): he signed in with ahmedelbaz28@gmail.com and the gate never stopped him. DB truth: that email maps to the pre-gate account @AHMEDBAZ (id=5, created 2026-05-03) — the v17 migration grandfathered every existing account as 'approved' by design, so the gate (which fires at session issuance for pending/rejected rows only) correctly never applied to it. New registrations ARE gated (22/22 live). ROOT FIX — reopenApproval (admin mutation + users-table button): - any NON-admin account can be put back into the pending queue at any time: approvalStatus=pending, decision columns cleared; - live session KILLED in the same write (tokenVersion bump + auth-cache eviction) — pending means no access, not just no NEW sessions; - admin rows stay untouchable (no self lock-out); already-pending rows error instead of double-writing; - the owner alert fan-out fires (in-app stream + email with fresh signed Approve/Reject links) so the decision can happen from the inbox. Con…175408e -
feat(approval): admin gate on registration — owner approves/rejects every join before login
ahmdelbaz28-uxOwner directive (2026-11-24): 'أنا كأدمن لازم أقبل أو أرفض أي حد يسجل في المنصة قبل ما يدخل — وعندي سلطة إلغاء دخول أي حد في أي وقت.' SERVER (enforced at EVERY session-issuance path): - users.approvalStatus (pending|approved|rejected) + decision columns, v17 idempotent migration — DEFAULT 'approved' grandfathers all pre-gate accounts with zero backfill; registration writes 'pending'. - register: creates the account pending, issues NO token/cookie, responds pendingApproval:true — the login gate enforces the rest. - login: gate AFTER credential+2FA verify, BEFORE session issuance — correct credentials are not enough. Stable APPROVAL_PENDING / APPROVAL_REJECTED sentinels drive the localized panels; pending retries never burn the per-account failure throttle. - Google OAuth callback + GIS: all paths gated; new Google sign-ups insert pending and receive NO session (redirect marker / 403 codes). - decideApproval: reject flips status AND bumps tokenVersion in ONE UPDATE (live…a7cb154
12 days ago
-
security(audit-cfskill-run2): root-cure round — all 8 confirmed findings fixed + 12 regression pins
Z UserCloudflare security-audit-skill scoped run-2 (delta f34855f..90c0124 + carried prior-run records). 8 confirmed (2 HIGH, 4 MEDIUM, 2 LOW), 3 needs_validation; Phase-5 record-verified with non-material remediation corrections applied. 1. HIGH settings publicQuery partition: deny-by-default PUBLIC_SETTINGS_SECTIONS allowlist in getAll (row filter) + getSection (zod refine BEFORE the cache lookup) — adminRecovery.backupHash / youtubeSync / youtubeWatch never served anonymously again; db-init claim/restore/reset2fa branches now call invalidateSettingsCache() so cached values never straddle the partition. 2. HIGH identity-endpoint projection: SafeUser narrowed from Omit<User,'passwordHash'> to a curated Pick<> of the exact 7 UI/server fields (explicit construction in loadUserFromDb — no spread); shared AuthMeOutput zod schema applied via .output() on BOTH auth.me and session.me (runtime strip) — the plaintext TOTP seed, OTP/token hashes, deviceFingerprint and pend…75bceac
13 days ago
-
fix(admin): dashboard audit — honest notifications composer + server broadcast history
ahmdelbaz28-uxROOT FIXES from the full dashboard audit: 1. Notifications composer lied about the notification type: Admin.tsx hardcoded type:'promo' because the composer offered enrollment/update/ custom — types the server z.enum REJECTS. The composer now speaks the server's vocabulary (promo/system/lesson/file/software/youtube) and the REAL picked type reaches the wire (pinned by E2E wire-contract test). 2. Composer lied about recipients & scheduling: the recipient filter and schedule UI were decorative (backend broadcasts to ALL users, no worker for scheduled sends). Both removed; the composer now states the honest contract (all registered users + Web Push + Telegram). 3. Composer lied about success: the 'sent successfully' toast fired even when the mutation failed. onSend is now awaited by the panel — success toast/history only after the server confirms, error toast on failure. 4. History tab was localStorage-only. New admin.broadcastHistory query serves SERVER t…2efd444
19 days ago
-
feat(admin): dashboard control completeness + audit trail — owner review
ahmdelbaz28-uxOwner directive: 'تراجع سلامة الداش بورد وأنها تغطي اللازم تماما ويمكن التحكم في كل شئ في الموقع منها بطريقة كاملة وسليمة' SECURITY REVIEW VERDICT: the admin gate is sound — every admin.* procedure runs requireRole('admin') with the role read from the DB row (never the JWT claim), revocation via tokenVersion + cache eviction, Google OAuth strips role/passwordHash. No missing gates found. NEW — Audit trail (was: zero accountability for destructive ops): - adminAuditLog table (schema + init-schema + migration v17, no FK — the trail survives user deletion) - auditAdmin middleware wired into the adminQuery/adminMutation choke point: every admin.* call records actor, procedure, ok/error, IP and a REDACTED input summary (sensitive keys+values replaced before storage — the self-test caught the first draft leaving secret VALUES in the trail) - admin.auditLog reader + Audit Log tab (append-only, paginated) NEW — Dashboard tabs for orphaned admin APIs: - FAQ tab: full CRUD + publish t…e5495e1
-
feat: chatbot typing cursor + auto-scroll + smooth animations, light mode icon color fixes
ahmdelbaz28-ux- Professional typing cursor (thin vertical bar with glow) - Auto-scroll during streaming and after message completion - Smooth fade-in animation for streaming text chunks - Smooth enter/exit animations for typing indicator (bouncing dots) - Fixed stacking timeout bug in typing exit animation - Added 8 new light mode icon color overrides (violet, emerald, rose, etc.) - Added placeholder colors, badge backgrounds, admin tab states10963b9