PageSourceSearch

https://blokshok.co.uk/assets/admin.login-Dtly4n_c.js

js blokshok.co.uk collected 2026-10-03 18:58:57 UTC 3,637 bytes, 1 lines download raw bytes

1import{d as j,e as N,R as k,r as t,j as e,s as n}from"./index-Dr__68gt.js";import{c as m}from"./createLucideIcon-DumiXXe1.js";const S=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],E=m("eye-off",S);const z=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],C=m("eye",z);function q(){const b=j(),p=N(),{error:x}=k.useSearch(),[l,h]=t.useState(""),[d,f]=t.useState(""),[a,g]=t.useState(!1),[r,i]=t.useState(!1),[c,o]=t.useState(x==="not_authorized"?"That account isn't authorized for admin access.":null);async function y(s){s.preventDefault(),o(null),i(!0);const{data:u,error:w}=await n.auth.signInWithPassword({email:l.trim(),password:d});if(w||!u.user){i(!1),o("Invalid email or password.");return}const{data:v}=await n.from("user_roles").select("role").eq("user_id",u.user.id).eq("role","admin").maybeSingle();if(!v){await n.auth.signOut(),i(!1),o("That account isn't authorized for admin access.");return}await p.invalidateQueries(),b({to:"/admin/dashboard",replace:!0})}return e.jsx("main",{className:"min-h-screen flex items-center justify-center bg-background px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("header",{className:"mb-8 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Admin sign in"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Restricted area. Authorized administrators only."})]}),e.jsxs("form",{onSubmit:y,noValidate:!0,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground",children:"Email"}),e.jsx("input",{id:"email",type:"email",autoComplete:"email",required:!0,value:l,onChange:s=>h(s.target.value),disabled:r,className:"mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-base shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground",children:"Password"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("input",{id:"password",type:a?"text":"password",autoComplete:"current-password",required:!0,minLength:6,value:d,onChange:s=>f(s.target.value),disabled:r,className:"block w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-base shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"}),e.jsx("button",{type:"button",onClick:()=>g(s=>!s),"aria-label":a?"Hide password":"Show password","aria-pressed":a,className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:a?e.jsx(E,{className:"size-4"}):e.jsx(C,{className:"size-4"})})]})]}),c&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:c}),e.jsx("button",{type:"submit",disabled:r,className:"w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",children:r?"Signing in…":"Sign in"})]})]})})}export{q as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.