PageSourceSearch

https://thedeepbrief.co.uk/assets/ResetPassword-5ZFXoKIX.js

js thedeepbrief.co.uk collected 2026-09-24 15:13:54 UTC 3,485 bytes, 1 lines download raw bytes

1import{r as s,j as e}from"./vendor-react-CUX7D0C7.js";import{u as S,S as C,C as P,B as u,L as h,I as p}from"./index-CKW83pDQ.js";import{C as k,E,a as R}from"./vendor-icons-kZFcvpIB.js";import"./vendor-pdf-CFaLvvvW.js";import"./vendor-ui-DV1JMX9G.js";import"./vendor-charts-Dis8PKHX.js";function I(){const[,x]=S(),[a,w]=s.useState(""),[l,f]=s.useState(""),[n,g]=s.useState(!1),[i,c]=s.useState(!1),[b,j]=s.useState(!1),[d,o]=s.useState(""),[m,y]=s.useState("");s.useEffect(()=>{const t=new URLSearchParams(window.location.search).get("token");t?y(t):o("Invalid or missing reset link. Please request a new one.")},[]);const N=async r=>{if(r.preventDefault(),a!==l){o("Passwords don't match");return}if(a.length<8){o("Password must be at least 8 characters");return}c(!0),o("");try{const t=await fetch("/api/auth/email/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:m,password:a})}),v=await t.json();if(!t.ok)throw new Error(v.error||"Failed to reset password");j(!0)}catch(t){o(t.message)}finally{c(!1)}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 via-white to-purple-50 px-4 py-12",children:[e.jsx(C,{title:"Reset Password | The Deep Brief"}),e.jsx(P,{className:"w-full max-w-md p-8 shadow-xl border-0 bg-white/80 backdrop-blur",children:b?e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(k,{className:"w-8 h-8 text-green-600"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Password reset"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Your password has been updated successfully."}),e.jsx(u,{onClick:()=>x("/sign-in"),className:"bg-purple-600 hover:bg-purple-700 text-white",children:"Sign in with new password"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-1",children:"Choose a new password"}),e.jsx("p",{className:"text-gray-600 text-sm",children:"Enter your new password below."})]}),d&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg mb-4 text-sm",children:d}),m?e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(h,{htmlFor:"password",className:"text-gray-700",children:"New password"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx(p,{id:"password",type:n?"text":"password",value:a,onChange:r=>w(r.target.value),placeholder:"Min. 8 characters",required:!0,autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>g(!n),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:n?e.jsx(E,{className:"h-4 w-4"}):e.jsx(R,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"confirm",className:"text-gray-700",children:"Confirm password"}),e.jsx(p,{id:"confirm",type:n?"text":"password",value:l,onChange:r=>f(r.target.value),placeholder:"Repeat your password",className:"mt-1",required:!0})]}),e.jsx(u,{type:"submit",className:"w-full bg-purple-600 hover:bg-purple-700 text-white",disabled:i||!a||!l,children:i?"Resetting...":"Reset password"})]}):e.jsx("div",{className:"text-center",children:e.jsx("a",{href:"/forgot-password",className:"text-purple-600 hover:underline text-sm font-medium",children:"Request a new reset link →"})})]})})]})}export{I 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.