PageSourceSearch

https://lamson.edu/assets/VerifyResetCodePage-CpfcMDfR.js

js lamson.edu collected 2026-10-02 20:21:57 UTC 5,238 bytes, 6 lines download raw bytes

1import{r as a,j as t}from"./index-sb-a_sm4.js";import{c as V,aI as _,aJ as M,s as P,l as O,h as A,k as B,L as z}from"./programViewCoordinator-BPOY-9uT.js";import{L as K}from"./label-Bg7qqimt.js";import{s as C,j as S}from"./App-6lxuXwub.js";import"./crypto-DFw8Wy1v.js";import"./advertisingWithdrawal-BCnNPF8t.js";import"./analyticsWithdrawal-Dre94QQH.js";import"./index-fC8Km9j6.js";import"./toaster-Dhm7GT39.js";import"./dialog-D24bFGkl.js";import"./MarketingTrackers-DuYFfY7A.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const T=V("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),W=O.url,y=60;function ee(){const f=_(),[b]=M(),l=a.useMemo(()=>(b.get("email")||"").trim().toLowerCase(),[b]),[x,m]=a.useState(["","","","","",""]),[h,j]=a.useState(!1),[w,u]=a.useState(null),[d,g]=a.useState(y),[p,N]=a.useState(!1),o=a.useRef([]);a.useEffect(()=>{l||f("/admin/forgot-password",{replace:!0})},[l,f]),a.useEffect(()=>{if(d<=0)return;const e=setTimeout(()=>g(n=>n-1),1e3);return()=>clearTimeout(e)},[d]),a.useEffect(()=>{var e;(e=o.current[0])==null||e.focus()},[]);const D=(e,n)=>{var r;u(null);const s=n.replace(/\D/g,"").slice(0,1);m(c=>{const i=[...c];return i[e]=s,i}),s&&e<5&&((r=o.current[e+1])==null||r.focus())},R=(e,n)=>{var s,r,c;n.key==="Backspace"&&!x[e]&&e>0&&((s=o.current[e-1])==null||s.focus()),n.key==="ArrowLeft"&&e>0&&((r=o.current[e-1])==null||r.focus()),n.key==="ArrowRight"&&e<5&&((c=o.current[e+1])==null||c.focus())},L=e=>{var c;const n=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6);if(!n)return;e.preventDefault();const s=["","","","","",""];for(let i=0;i<n.length;i++)s[i]=n[i];m(s);const r=Math.min(n.length,5);(c=o.current[r])==null||c.focus()},v=x.join(""),k=v.length===6,E=async e=>{var n;if(e==null||e.preventDefault(),!(!k||h)){j(!0),u(null);try{const{data:s,error:r}=await C.functions.invoke("verify-admin-reset-code",{body:{email:l,code:v}});if(r)throw r;if(!(s!=null&&s.success)){u((s==null?void 0:s.error)||"Invalid or expired code"),m(["","","","","",""]),(n=o.current[0])==null||n.focus();return}sessionStorage.setItem("admin_reset_token",s.reset_token),sessionStorage.setItem("admin_reset_email",l),f("/admin/reset-password")}catch(s){console.error(s),u("Something went wrong. Please try again.")}finally{j(!1)}}},I=async()=>{var e;if(!(d>0||p)){N(!0);try{await C.functions.invoke("send-admin-reset-code",{body:{email:l}}),S.success("If an admin account exists for this email, a new code has been sent."),g(y),m(["","","","","",""]),(e=o.current[0])==null||e.focus()}catch{S.success("If an admin account exists for this email, a new code has been sent."),g(y)}finally{N(!1)}}};return t.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-muted p-4",children:[t.jsx(P,{title:"Verify Reset Code | Lamson Admin",description:"Verify your password reset code.",noIndex:!0}),t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-background rounded-2xl shadow-brand-xl p-8",children:[t.jsxs("div",{className:"text-center mb-8",children:[t.jsx("img",{src:W,alt:"Lamson",className:"h-16 mx-auto mb-6"}),t.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:t.jsx(T,{className:"w-6 h-6 text-primary"})}),t.jsx("h1",{className:"text-2xl font-heading font-bold text-foreground",children:"Enter Verification Code"}),t.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"We sent a 6-digit code to"}),t.jsx("p",{className:"font-medium text-foreground text-sm break-all",children:l})]}),t.jsxs("form",{onSubmit:E,className:"space-y-5",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(K,{className:"sr-only",children:"Verification code"}),t.jsx("div",{className:"flex justify-between gap-2",children:x.map((e,n)=>t.jsx("input",{ref:s=>o.current[n]=s,inputMode:"numeric",autoComplete:"one-time-code",maxLength:1,value:e,onCh
6ange:s=>D(n,s.target.value),onKeyDown:s=>R(n,s),onPaste:L,className:"w-11 h-14 sm:w-12 sm:h-14 text-center text-2xl font-bold rounded-md border border-input bg-background focus:outline-none focus:ring-2 focus:ring-ring","aria-label":`Digit ${n+1}`},n))}),w&&t.jsx("p",{className:"text-sm text-destructive text-center pt-1",children:w})]}),t.jsx(A,{type:"submit",className:"w-full",disabled:!k||h,children:h?t.jsxs(t.Fragment,{children:[t.jsx(B,{className:"w-4 h-4 animate-spin mr-2"}),"Verifying..."]}):"Verify Code"})]}),t.jsxs("div",{className:"mt-6 flex flex-col items-center gap-3 text-sm",children:[t.jsx("button",{type:"button",onClick:I,disabled:d>0||p,className:"text-primary hover:underline disabled:text-muted-foreground disabled:no-underline disabled:cursor-not-allowed",children:p?"Resending...":d>0?`Resend code in ${d}s`:"Resend code"}),t.jsx(z,{to:"/admin/login",className:"text-muted-foreground hover:text-primary transition-colors",children:"← Back to Login"})]})]})})]})}export{ee as default};

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.