mirror of
https://github.com/hyzendust/hyzendust.github.io.git
synced 2026-06-30 23:12:16 +02:00
14 lines
12 KiB
HTML
14 lines
12 KiB
HTML
<!doctype html><html class=html lang=en-us dir=ltr><head><meta charset=utf-8><meta name=viewport content="width=device-width"><title>User Management | Freedoms4</title><link rel=stylesheet href=/css/style.min.34d0accb85f8ec23ceee8c29eef5907823b531d8acb9e6bdf45a3b37ad028d30.css integrity="sha256-NNCsy4X47CPO7owp7vWQeCO1Mdisuea99Fo7N60CjTA=" crossorigin=anonymous><link rel=icon href=/favicon.ico><meta property="og:url" content="https://freedoms4.org/admin/"><meta property="og:site_name" content="Freedoms4"><meta property="og:title" content="User Management"><meta property="og:locale" content="en_us"><meta property="og:type" content="article"><meta itemprop=name content="User Management"><link rel=stylesheet href=/css/custom.css><script>(function(){var e=localStorage.getItem("theme");e&&document.documentElement.setAttribute("data-theme",e),localStorage.getItem("f4_username")==="hyzen"&&document.documentElement.classList.add("hyzen-user")})()</script><script async src=https://plausible.freedoms4.org/js/pa-5BKl0z0RLzwrclKq4y-qk.js></script><script>(window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(e){plausible.o=e||{}}),plausible.init()</script></head><body class=body><header class=header><div class=brand><img src=/logo.png alt="Freedoms4 logo"><h1>Freedoms4</h1><div class=brand__actions><button class=theme-toggle id=theme-toggle aria-label="Toggle theme" title="Toggle dark/light mode">
|
||
<svg class="theme-toggle__sun" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M12 7c-2.76.0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55.0 1-.45 1-1s-.45-1-1-1H2c-.55.0-1 .45-1 1s.45 1 1 1zm18 0h2c.55.0 1-.45 1-1s-.45-1-1-1h-2c-.55.0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41.0-.39.39-.39 1.03.0 1.41l1.06 1.06c.39.39 1.03.39 1.41.0s.39-1.03.0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41.0-.39.39-.39 1.03.0 1.41l1.06 1.06c.39.39 1.03.39 1.41.0.39-.39.39-1.03.0-1.41l-1.06-1.06zm1.06-12.37-1.06 1.06c-.39.39-.39 1.03.0 1.41s1.03.39 1.41.0l1.06-1.06c.39-.39.39-1.03.0-1.41s-1.03-.39-1.41.0zM7.05 18.36l-1.06 1.06c-.39.39-.39 1.03.0 1.41s1.03.39 1.41.0l1.06-1.06c.39-.39.39-1.03.0-1.41s-1.03-.39-1.41.0z"/></svg>
|
||
<svg class="theme-toggle__moon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg></button><div class=brand__auth><input type=checkbox id=auth-dropdown class=brand__auth-check>
|
||
<label class=brand__auth-toggle for=auth-dropdown tabindex=0 aria-label="Account options"><svg viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M12 12c2.7.0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2.0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg></label><div class=brand__auth-links><a href=/login/ class="auth-link auth-link--login">Login</a>
|
||
<a href=/signup/ class="auth-link auth-link--signup">Sign Up</a></div></div><div class=rss-subscribe><button class=rss-subscribe__btn aria-label="Subscribe via RSS" title="Subscribe via RSS">
|
||
<svg viewBox="0 0 24 24" width="10" height="10" fill="currentColor" aria-hidden="true"><path d="M6.18 15.64a2.18 2.18.0 012.18 2.18c0 1.19-.98 2.18-2.18 2.18C4.98 20 4 19.01 4 17.82a2.18 2.18.0 012.18-2.18M4 4.44A15.56 15.56.0 0119.56 20h-2.83A12.73 12.73.0 004 7.27V4.44m0 5.66a9.9 9.9.0 019.9 9.9h-2.83A7.07 7.07.0 004 12.93V10.1z"/></svg>
|
||
<span>Subscribe</span></button><div class=rss-subscribe__dropdown><button class=rss-subscribe__item data-rss-url=https://freedoms4.org/index.xml>
|
||
All updates
|
||
</button>
|
||
<button class=rss-subscribe__item data-rss-url=https://freedoms4.org/blog/index.xml>
|
||
Blog posts</button></div></div></div></div><nav class="menu language"><ul class="menu__list language__list"><li class=menu__item><a class=menu__link href=/>Home</a></li><li class=menu__item><a class=menu__link href=/blog/>Blog</a></li><li class=menu__item><a class=menu__link href=/services/>Services</a></li><li class=menu__item><a class=menu__link href=/uninotes/>UniNotes</a></li><li class=menu__item><a class=menu__link href=/contact/>Contact</a></li></ul></nav></header><main class=main><div id=admin-gate style=display:none><p>You do not have permission to access this page.</p></div><div id=admin-panel style=display:none><h1>User Management</h1><label class=admin-search for=admin-user-search><span class=admin-search__label>Search users</span>
|
||
<input id=admin-user-search class=admin-search__input type=search placeholder="Search by username or email" autocomplete=off></label><div id=admin-msg class=auth-message style=display:none aria-live=polite></div><div id=admin-table-wrap></div></div><script>(function(){var r="https://backend.freedoms4.org/admin.php",l=localStorage.getItem("f4_username"),u=document.getElementById("admin-gate"),d=document.getElementById("admin-panel"),s=document.getElementById("admin-msg"),e=document.getElementById("admin-table-wrap"),a=document.getElementById("admin-user-search"),t=[];if(l!=="hyzen"){u.style.display="";return}d.style.display="";function i(e,t){s.textContent=e,s.className="auth-message auth-message--"+t,s.style.display="block",setTimeout(function(){s.style.display="none"},3e3)}function n(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function h(s){if(!s.length){e.innerHTML="<p>No matching users found.</p>";return}var a='<table class="admin-table"><tbody><tr class="admin-table__header"><th>#</th><th>Username</th><th>Email</th><th>Joined</th><th>Status</th><th>Actions</th></tr>';function l(e){var s=new Date(e.created_at).toLocaleDateString(),t=e.blocked===!0||e.blocked==="t"||e.blocked==="1",o=t?'<span class="admin-badge admin-badge--blocked">Blocked</span>':'<span class="admin-badge admin-badge--active">Active</span>',i=t?'<button class="admin-btn admin-btn--unblock" data-id="'+e.id+'" data-action="unblock_user">Unblock</button>':'<button class="admin-btn admin-btn--block" data-id="'+e.id+'" data-action="block_user">Block</button>',a='<button class="admin-btn admin-btn--delete" data-id="'+e.id+'" data-username="'+n(e.username)+'" data-action="delete_user">Delete Records</button>';return'<tr id="user-row-'+e.id+'"><td>'+e.id+"</td><td>"+n(e.username)+"</td><td>"+n(e.email)+"</td><td>"+s+"</td><td>"+o+'</td><td class="admin-actions">'+i+" "+a+"</td></tr>"}s.forEach(function(e){a+=l(e)}),a+="</tbody></table>",e.innerHTML=a,e.querySelectorAll("[data-action]").forEach(function(e){e.addEventListener("click",function(){var n=e.dataset.action,s=parseInt(e.dataset.id,10),a=e.dataset.username||"";if(n==="delete_user"){if(!confirm('Permanently delete user "'+a+'"? This cannot be undone.'))return}else if(n==="block_user"&&!confirm("This will permanently delete the user's email history and cannot be undone"))return;e.disabled=!0,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({action:n,user_id:s})}).then(function(e){return e.json()}).then(function(a){a.success?n==="delete_user"?(t=t.filter(function(e){return Number(e.id)!==s}),o(),i("User deleted.","success")):c():(i(a.message||"Action failed.","error"),e.disabled=!1)}).catch(function(){i("Network error.","error"),e.disabled=!1})})})}function c(){e.innerHTML="<p>Loading…</p>",fetch(r+"?action=list_users",{credentials:"include"}).then(function(e){return e.json()}).then(function(s){s.success?(t=s.users,o()):e.innerHTML='<p class="admin-error">'+n(s.message||"Failed to load users.")+"</p>"}).catch(function(){e.innerHTML='<p class="admin-error">Network error.</p>'})}function o(){var e=a.value.trim().toLowerCase(),n=t.filter(function(t){return t.username!==l&&(!e||String(t.username).toLowerCase().includes(e)||String(t.email).toLowerCase().includes(e))});h(n)}a.addEventListener("input",o),c()})()</script></main><footer class=footer><p class=footer__copyright-notice>© <a href=https://freedoms4.org>freedoms4.org</a>
|
||
<a href=/terms/>Terms and Conditions</a> <a href=/privacy/>Privacy Policy</a>
|
||
<a href=/changelog/>Changelog</a></p><p class=footer__theme-info>Built with <a href=https://gohugo.io>Hugo</a> and based on <a href=https://github.com/CyrusYip/hugo-theme-yue>Yue</a> theme</p></footer><script>(function(){document.querySelectorAll(".menu__item").forEach(function(e){var t=e.querySelector("a");t&&t.getAttribute("href")==="/uninotes/"&&e.classList.add("menu__item--uninotes")})})()</script><script>(function(){var e=document.getElementById("theme-toggle");if(!e)return;function t(){var e=localStorage.getItem("theme");return e?e:window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function n(e){document.documentElement.setAttribute("data-theme",e),localStorage.setItem("theme",e)}n(t()),e.addEventListener("click",function(){var e=document.documentElement.getAttribute("data-theme")||t();n(e==="dark"?"light":"dark")})})()</script><script>(function(){var t="https://backend.freedoms4.org/auth.php",e=localStorage.getItem("f4_username");if(!e)return;function n(e){var t,n,o,i,a,c,r=document.querySelector(".brand__auth");r&&!r.querySelector(".brand__auth-user")&&(r.classList.add("brand__auth--loggedin"),t=document.createElement("div"),t.className="brand__auth-user",n=document.createElement("button"),n.className="brand__auth-user-btn",n.setAttribute("aria-label","Account menu"),c=document.createElement("span"),c.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg>',n.appendChild(c.firstChild),n.appendChild(document.createTextNode(" "+e)),o=document.createElement("div"),o.className="brand__auth-user-dropdown",i=document.createElement("button"),i.className="brand__auth-user-logout",i.textContent="Log Out",i.addEventListener("click",s),e==="hyzen"&&(a=document.createElement("a"),a.className="brand__auth-user-admin",a.href="/admin/",a.textContent="User Management",o.appendChild(a)),o.appendChild(i),o.appendChild(i),t.appendChild(n),t.appendChild(o),r.appendChild(t),n.addEventListener("click",function(e){e.stopPropagation(),t.classList.toggle("is-open")}),document.addEventListener("click",function(){t.classList.remove("is-open")}))}function s(){fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({action:"logout"})}).finally(function(){localStorage.removeItem("f4_username"),localStorage.removeItem("f4_login_time"),localStorage.removeItem("f4_session_fails"),window.location.reload()})}n(e)})()</script><script>(function(){var t,e=document.querySelector(".rss-subscribe");if(!e)return;t=e.querySelector(".rss-subscribe__btn"),t.addEventListener("click",function(t){t.stopPropagation(),e.classList.toggle("is-open")}),document.addEventListener("click",function(t){e.contains(t.target)||e.classList.remove("is-open")}),e.querySelectorAll(".rss-subscribe__item").forEach(function(t){t.addEventListener("click",function(n){n.stopPropagation();var s,o=t.getAttribute("data-rss-url"),a=t.textContent;function i(){t.textContent="Copied!",setTimeout(function(){t.textContent=a,e.classList.remove("is-open")},1200)}try{s=document.createElement("textarea"),s.value=o,s.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none;",document.body.appendChild(s),s.focus(),s.select(),document.execCommand("copy"),document.body.removeChild(s),i()}catch{navigator.clipboard&&navigator.clipboard.writeText(o).then(i).catch(function(){t.textContent=o})}})})})()</script><script src=/js/session-check.js></script></body></html> |