PageSourceSearch

https://smilelink.ai/assets/ResetPassword-B09ekB-a.js

js smilelink.ai collected 2026-10-05 15:06:46 UTC 5,886 bytes, 1 lines download raw bytes

1import{i as L,t as V,r as a,j as e,I as r,L as W}from"./vendor-react-CzeUTGov.js";import{e as v}from"./index-D8i6mkgM.js";import{I as k}from"./input-heCNN2X-.js";import{F as N}from"./formfield-7i1sZ73Y.js";import{A as m}from"./AuthShell-DBBiSRE6.js";import"./vendor-lexical-Xg5EA0K0.js";import"./vendor-utils-BI4G-MlY.js";import"./icons-DjXeRAwe.js";const O=()=>{const u=L(),[y]=V(),o=y.get("token"),[l,S]=a.useState(""),[n,C]=a.useState(""),[c,g]=a.useState(!1),[T,x]=a.useState(!0),[P,E]=a.useState(!1),[R,F]=a.useState(""),[h,t]=a.useState(""),[w,j]=a.useState(""),f=[{label:"At least 8 characters",met:l.length>=8},{label:"Contains uppercase letter",met:/[A-Z]/.test(l)},{label:"Contains lowercase letter",met:/[a-z]/.test(l)},{label:"Contains number",met:/\d/.test(l)},{label:"Contains special character",met:/[!@#$%^&*]/.test(l)}],d=f.filter(s=>s.met).length,p=d>=5?{score:100,text:"Strong",level:"strong"}:d===4?{score:80,text:"Good",level:"good"}:d===3?{score:60,text:"Fair",level:"fair"}:d===2?{score:40,text:"Weak",level:"weak"}:{score:20,text:"Very weak",level:"weak"},b=a.useCallback(async()=>{try{const s=await v.post("/public/password-reset/validate/",{token:o});s.data.valid?(E(!0),F(s.data.email)):t(s.data.error||"This reset link is invalid or has expired.")}catch(s){const i=typeof s=="object"&&s!==null&&"response"in s?s.response?.data?.error:void 0;t(i||"This reset link is invalid or has expired.")}finally{x(!1)}},[o]);a.useEffect(()=>{o?b():(t("This reset link is invalid or has expired."),x(!1))},[o,b]);const I=async s=>{if(s.preventDefault(),t(""),j(""),!l||!n){t("Fill in both password fields to continue.");return}if(l!==n){t("The passwords don't match. Check them and try again.");return}if(l.length<8){t("Your password needs at least 8 characters.");return}g(!0);try{(await v.post("/public/password-reset/confirm/",{token:o,password:l,confirm_password:n})).status===200&&(j("Your password has been reset. Taking you to sign in..."),setTimeout(()=>{u("/login")},3e3))}catch(i){const q=typeof i=="object"&&i!==null&&"response"in i?i.response?.data?.error:void 0;t(q||"We couldn't reset your password. Try again in a moment.")}finally{g(!1)}};return T?e.jsx(m,{layout:"single",children:e.jsx("section",{className:"sl3-panel sl3-panel-hard-shadow sl3-login-panel",children:e.jsx("div",{className:"sl3-login-panel-content",children:e.jsxs("div",{className:"sl3-login-panel-heading",children:[e.jsx("p",{className:"sl3-type-mono",children:"Workspace access"}),e.jsx("h2",{children:"One moment."}),e.jsx("p",{children:"Checking your reset link."})]})})})}):P?e.jsx(m,{layout:"single",children:e.jsx("section",{className:"sl3-panel sl3-panel-hard-shadow sl3-login-panel","aria-labelledby":"sl3-reset-title",children:e.jsxs("div",{className:"sl3-login-panel-content",children:[e.jsxs(W,{to:"/login",className:"sl3-login-back",children:[e.jsx(r,{icon:"lucide:arrow-left",width:15,height:15}),"Back to sign in"]}),e.jsxs("div",{className:"sl3-login-panel-heading",children:[e.jsx("p",{className:"sl3-type-mono",children:"Workspace access"}),e.jsx("h2",{id:"sl3-reset-title",children:"Set a new password."}),e.jsxs("p",{children:["For ",e.jsx("strong",{children:R})]})]}),w&&e.jsxs("div",{className:"sl3-login-alert sl3-login-alert-success",role:"status",children:[e.jsx(r,{icon:"lucide:check-circle",width:19,height:19}),e.jsx("span",{children:w})]}),h&&e.jsxs("div",{className:"sl3-login-alert sl3-login-alert-error",role:"alert",children:[e.jsx(r,{icon:"lucide:alert-circle",width:19,height:19}),e.jsx("span",{children:h})]}),e.jsxs("form",{onSubmit:I,className:"sl3-login-form",children:[e.jsx(N,{className:"sl3-login-field",label:"New password",children:e.jsx(k,{className:"sl3-field-control sl3-login-input",type:"password",autoComplete:"new-password",value:l,onChange:s=>S(s.target.value),placeholder:"Enter new password",showPasswordToggle:!0,disabled:c,inputSize:"lg",required:!0})}),l&&e.jsxs("div",{className:"sl3-login-strength","data-strength":p.level,children:[e.jsx("div",{className:"sl3-login-strength-track",children:e.jsx("div",{className:"sl3-login-strength-fill",style:{width:`${p.score}%`}})}),e.jsx("p",{children:p.text})]}),l&&e.jsx("ul",{className:"sl3-login-reqs","aria-label":"Password requirements",children:f.map(s=>e.jsxs("li",{className:"sl3-login-req","data-met":s.met,children:[e.jsx(r,{icon:s.met?"lucide:check":"lucide:x",width:14,height:14}),e.jsx("span",{children:s.label})]},s.label))}),e.jsx(N,{className:"sl3-login-field",label:"Confirm new password",error:n&&l!==n?"Passwords don't match":"",children:e.jsx(k,{className:"sl3-field-control sl3-login-input",type:"password",autoComplete:"new-password",value:n,onChange:s=>C(s.target.value),placeholder:"Confirm new password",showPasswordToggle:!0,disabled:c,inputSize:"lg",required:!0})}),e.jsxs("button",{type:"submit",disabled:c||!l||!n,className:"sl3-button sl3-login-submit",children:[e.jsx("span",{children:c?"Re
1setting...":"Reset password"}),e.jsx(r,{icon:"lucide:arrow-right",width:18,height:18})]})]})]})})}):e.jsx(m,{layout:"single",children:e.jsx("section",{className:"sl3-panel sl3-panel-hard-shadow sl3-login-panel","aria-labelledby":"sl3-reset-invalid-title",children:e.jsxs("div",{className:"sl3-login-panel-content",children:[e.jsxs("div",{className:"sl3-login-panel-heading",children:[e.jsx("p",{className:"sl3-type-mono",children:"Workspace access"}),e.jsx("h2",{id:"sl3-reset-invalid-title",children:"Link expired."}),e.jsx("p",{children:h})]}),e.jsxs("div",{className:"sl3-login-sent",children:[e.jsx("p",{children:"Reset links only work for a short time. Request a new one and we'll send it straight away."}),e.jsxs("button",{type:"button",onClick:()=>u("/forgot-password"),className:"sl3-button sl3-login-submit",children:[e.jsx("span",{children:"Request new link"}),e.jsx(r,{icon:"lucide:arrow-right",width:18,height:18})]})]})]})})})};export{O 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.