PageSourceSearch

https://cloud.resilis.io/assets/reset-password-D41yEKdl.js

js resilis.io collected 2026-10-02 05:51:19 UTC 5,010 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-vendor-Nh__yRYT.js";import{a2 as R,B as n,a3 as I}from"./index-BinsBWQu.js";import{g as L,a as s,L as d}from"./react-vendor-NvA41F0Y.js";import{r as E}from"./auth-session-transitions-Dds_Hvew.js";import{I as v}from"./input-mDdvRMTd.js";import{L as g}from"./label-Xg45tH-2.js";import{C as Y}from"./circle-x-CcPFwquI.js";import{C as q}from"./circle-check-DVJ2Gbnx.js";import{E as N}from"./eye-off-DEWjTAry.js";import{E as y}from"./eye-DSWi_tE9.js";function z(){const[u]=L(),[a,P]=s.useState(""),[x,b]=s.useState(""),[c,C]=s.useState(!1),[l,S]=s.useState(!1),[o,h]=s.useState(!1),[p,f]=s.useState("form"),{toast:t}=R(),i=u.get("token"),m=u.get("error"),w=s.useMemo(()=>m&&m.toLowerCase()==="invalid_token"?"This password reset link is invalid or has expired.":i?"":"No password reset token was provided.",[m,i]),k=async r=>{if(r.preventDefault(),!i){f("invalid");return}if(a.length<8){t({title:"Password too short",description:"Your new password must be at least 8 characters long.",variant:"destructive"});return}if(a!==x){t({title:"Passwords do not match",description:"Please enter the same password in both fields.",variant:"destructive"});return}h(!0);try{const{error:j}=await E({newPassword:a,token:i});if(j){t({title:"Reset failed",description:j.message||"Failed to reset your password.",variant:"destructive"});return}f("success"),t({title:"Password reset",description:"Your password has been updated. You can sign in now."})}catch{t({title:"Error",description:"An unexpected error occurred while resetting your password.",variant:"destructive"})}finally{h(!1)}};return w||p==="invalid"?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"Reset Password"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 py-8",children:[e.jsx(Y,{className:"h-16 w-16 text-destructive"}),e.jsx("h2",{className:"text-xl font-semibold text-destructive",children:"Reset Link Invalid"}),e.jsx("p",{className:"text-muted-foreground text-center",children:w||"This password reset link is invalid or has expired."}),e.jsxs("div",{className:"flex flex-col items-center gap-2 mt-4",children:[e.jsx(d,{to:"/forgot-password",children:e.jsx(n,{children:"Request a new link"})}),e.jsx(d,{to:"/sign-in",children:e.jsx(n,{variant:"outline",children:"Go to Sign In"})})]})]})]}):p==="success"?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"Reset Password"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 py-8",children:[e.jsx(q,{className:"h-16 w-16 text-status-success"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Password updated"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"Your password has been reset successfully. You can now sign in with your new password."}),e.jsx(d,{to:"/sign-in",children:e.jsx(n,{className:"mt-4",children:"Continue to Sign In"})})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"Choose a new password"})}),e.jsxs("form",{onSubmit:k,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"password",children:"New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{id:"password",type:c?"text":"password",placeholder:"••••••••",value:a,onChange:r=>P(r.target.value),required:!0,disabled:o,className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>C(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?e.jsx(N,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"confirmPassword",children:"Confirm New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(v,{id:"confirmPassword",type:l?"text":"password",placeholder:"••••••••",value:x,onChange:r=>b(r.target.value),required:!0,disabled:o,className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>S(!l),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,
1children:l?e.jsx(N,{className:"h-4 w-4"}):e.jsx(y,{className:"h-4 w-4"})})]})]})]}),e.jsx(n,{type:"submit",className:"w-full",disabled:o,children:o?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4"}),"Resetting..."]}):"Reset Password"}),e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["Remember your password?"," ",e.jsx(d,{to:"/sign-in",className:"font-medium text-resilis-core hover:underline",children:"Sign in"})]})]})]})}export{z as ResetPasswordPage};

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.