PageSourceSearch

https://jobspidey.com/assets/ChangePassword-DrlEktXf.js

js jobspidey.com collected 2026-10-04 03:14:09 UTC 5,483 bytes, 1 lines download raw bytes

1import{u as b,r as o,j as e,L as p}from"./index-gGPAhYiP.js";import{a as y}from"./apiErrorMessage-BTbqsaiN.js";import{T as j}from"./TransactionFrame-CBbAggOp.js";import{A as N}from"./arrow-left-DDb6eYND.js";import{K as v}from"./key-round-CxWzUkV8.js";import{L as _}from"./lock-B5SiycP-.js";import{S as C}from"./save-ByCmXjNS.js";import"./BrandLogo-DN_n9aKk.js";import"./arrow-up-right-BIugklqt.js";const w={current_password:"",new_password:"",confirm_password:""};function I(){const{user:i,changePassword:x}=b(),t=o.useRef(!1),[s,l]=o.useState(w),[u,m]=o.useState(!1),[n,a]=o.useState({tone:"",text:""});o.useEffect(()=>(t.current=!0,()=>{t.current=!1}),[]);const c=d=>{const{name:r,value:f}=d.target;l(g=>({...g,[r]:f}))},h=async d=>{if(d.preventDefault(),a({tone:"",text:""}),s.new_password.length<8){a({tone:"error",text:"New password must be at least 8 characters."});return}if(s.new_password.length>128){a({tone:"error",text:"New password must be 128 characters or fewer."});return}if(s.new_password!==s.confirm_password){a({tone:"error",text:"New password and confirmation do not match."});return}if(s.current_password===s.new_password){a({tone:"error",text:"New password must be different from your current password."});return}m(!0);try{const r=await x({current_password:s.current_password,new_password:s.new_password},{isActive:()=>t.current});if(!t.current||(l(w),!r.isCurrentAuthAction()&&r.isCurrentAccount?.()!==!0))return;a({tone:"success",text:r.data?.message||"Password updated successfully.",accountId:i?.id})}catch(r){if(!t.current||r?.code==="ERR_CANCELED")return;console.error("Failed to change password",r),a({tone:"error",text:!r.response||r.response.status>=500?"We couldn't confirm whether your password changed. Try signing in with your new password before changing it again.":y(r,"Failed to change password. Please try again.")})}finally{t.current&&m(!1)}};return e.jsx(j,{embedded:!0,className:"transaction-password-change",children:e.jsxs("div",{children:[e.jsxs(p,{to:"/account",className:"transaction-back",children:[e.jsx(N,{className:"h-4 w-4"}),"Back to Account"]}),e.jsxs("section",{className:"transaction-card",children:[e.jsxs("header",{className:"transaction-card-header flex items-start gap-4",children:[e.jsx("div",{className:"transaction-security-icon shrink-0",children:e.jsx(v,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"transaction-eyebrow",children:"Account Security"}),e.jsx("h1",{children:"Change your password"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-brand-secondary",children:"Update the password used for email sign-in. Google-only accounts can continue using Google sign-in."})]})]}),n.text&&(n.accountId===void 0||n.accountId===i?.id)?e.jsx("div",{className:`mt-6 rounded-xl border p-4 text-sm font-semibold ${n.tone==="success"?"border-blue-200 bg-blue-50 text-blue-800":"border-red-200 bg-red-50 text-red-700"}`,children:n.text}):null,e.jsxs("form",{onSubmit:h,className:"mt-6 space-y-5",children:[e.jsx("div",{className:"transaction-note",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-brand-primary/10 text-brand-primary",children:e.jsx(_,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-brand-dark",children:"Password sign-in"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-brand-secondary",children:"Your current password is required before JobSpidey accepts a new one."})]})]})}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"account-current-password",className:"mb-1 block text-sm font-medium text-gray-700",children:"Current Password"}),e.jsx("input",{id:"account-current-password",type:"password",name:"current_password",value:s.current_password,onChange:c,autoComplete:"current-password",maxLength:128,className:"w-full rounded-lg border border-gray-200 p-2.5 outline-none focus:ring-2 focus:ring-brand-primary",placeholder:"Enter your current password",required:!0})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"account-new-password",className:"mb-1 block text-sm font-medium text-gray-700",children:"New Password"}),e.jsx("input",{id:"account-new-password",type:"password",name:"new_password",value:s.new_password,onChange:c,autoComplete:"new-password",minLength:8,maxLength:128,className:"w-full rounded-lg border border-gray-200 p-2.5 outline-none focus:ring-2 focus:ring-brand-primary",placeholder:"Create a new password",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"account-confirm-password",className:"mb-1 block text-sm font-medium text-gray-700",children:"Confirm New Password"}),e.jsx("input",{id:"account-confirm-password",type:"password",name:"confirm_password",value:s.confirm_password,onChange:c,autoComplete:"new-password",minLength:8,maxLength:128,className:"w-full rounded-lg border border-gray-200 p-2.5 outline-none focus:ring-2 focus:ring-brand-primary",placeholder:"Repeat your new password",required:!0})]})]}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-3 border-t border-gray-100 pt-5",children:[e.jsx(p,{to:"/account",className:"transaction-action",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:u,className:"transaction-action transaction-action--primary",children:[e.jsx(C,{className:"h-4 w-4"}),u?"Saving...":"Save Password"]})]})]})]})]})})}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.