transcriptor-web/public/build/assets/UpdatePasswordForm-DVugAY5_.js
2025-04-05 15:58:14 +02:00

2 lines
2.3 KiB
JavaScript

import{u,m as i,r as p,j as r}from"./app-43FwoUKv.js";import{c as w}from"./index-C3aXnQRR.js";import{A as f}from"./ActionMessage-BR0zIw5R.js";import{F as x}from"./FormSection-fM5DX8Wc.js";import{T as o,I as e}from"./TextInput-CdoY_jBz.js";import{I as t}from"./InputLabel-Cl3yDvOx.js";import{P as j}from"./PrimaryButton-Gixff4KF.js";import"./transition-aKza8ZE9.js";import"./SectionTitle-CmR6E75W.js";function S(){const m=u(),s=i({current_password:"",password:"",password_confirmation:""}),n=p.useRef(null),c=p.useRef(null);function l(){s.put(m("user-password.update"),{errorBag:"updatePassword",preserveScroll:!0,onSuccess:()=>s.reset(),onError:()=>{var a,d;s.errors.password&&(s.reset("password","password_confirmation"),(a=n.current)==null||a.focus()),s.errors.current_password&&(s.reset("current_password"),(d=c.current)==null||d.focus())}})}return r.jsxs(x,{onSubmit:l,title:"Update Password",description:"Ensure your account is using a long, random password to stay secure.",renderActions:()=>r.jsxs(r.Fragment,{children:[r.jsx(f,{on:s.recentlySuccessful,className:"mr-3",children:"Saved."}),r.jsx(j,{className:w({"opacity-25":s.processing}),disabled:s.processing,children:"Save"})]}),children:[r.jsxs("div",{className:"col-span-6 sm:col-span-4",children:[r.jsx(t,{htmlFor:"current_password",children:"Current Password"}),r.jsx(o,{id:"current_password",type:"password",className:"mt-1 block w-full",ref:c,value:s.data.current_password,onChange:a=>s.setData("current_password",a.currentTarget.value),autoComplete:"current-password"}),r.jsx(e,{message:s.errors.current_password,className:"mt-2"})]}),r.jsxs("div",{className:"col-span-6 sm:col-span-4",children:[r.jsx(t,{htmlFor:"password",children:"New Password"}),r.jsx(o,{id:"password",type:"password",className:"mt-1 block w-full",value:s.data.password,onChange:a=>s.setData("password",a.currentTarget.value),autoComplete:"new-password",ref:n}),r.jsx(e,{message:s.errors.password,className:"mt-2"})]}),r.jsxs("div",{className:"col-span-6 sm:col-span-4",children:[r.jsx(t,{htmlFor:"password_confirmation",children:"Confirm Password"}),r.jsx(o,{id:"password_confirmation",type:"password",className:"mt-1 block w-full",value:s.data.password_confirmation,onChange:a=>s.setData("password_confirmation",a.currentTarget.value),autoComplete:"new-password"}),r.jsx(e,{message:s.errors.password_confirmation,className:"mt-2"})]})]})}export{S as default};