1import{u as E,e as L,a as A,r as a,j as e,G as n,H as U,m as N,I as c,B as F,L as I,s as B}from"./index-KSWbwNeY.js";import{P as D}from"./ProfileSidebar-RSiubeOO.js";import H from"./Footer-DPSMpmUX.js";import{L as M}from"./lock-DNHSxtLD.js";import{E as m}from"./eye-off-DqR1XpTQ.js";import{E as x}from"./eye-Cwzmef_1.js";import{S as T}from"./shield-check-CHHnEQz_.js";import"./alert-dialog-DFWe8irl.js";import"./index-BpbyRUKB.js";import"./trash-2-CwcwS_bf.js";import"./monitor-DWTsCiB7.js";import"./twitter-yEUqfNJX.js";import"./linkedin-B1bA0DJP.js";import"./youtube-CwivUiPT.js";import"./facebook-DahhNxAJ.js";const ee=()=>{const{user:v,loading:u}=E(),b=L(),{toast:r}=A(),[y,p]=a.useState(""),[o,h]=a.useState(""),[w,f]=a.useState(""),[j,g]=a.useState(!1),[l,P]=a.useState(!1),[i,S]=a.useState(!1),[d,C]=a.useState(!1);if(!u&&!v)return b("/auth?redirect=/profile/password"),null;const k=async s=>{if(s.preventDefault(),o!==w){r({title:"Error",description:"New passwords do not match",variant:"destructive"});return}if(o.length<6){r({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}g(!0);try{const{error:t}=await B.auth.updateUser({password:o});if(t)throw t;r({title:"Success",description:"Your password has been updated"}),p(""),h(""),f("")}catch(t){console.error("Error updating password:",t),r({title:"Error",description:t.message||"Failed to update password",variant:"destructive"})}finally{g(!1)}};return u?e.jsx("div",{className:"min-h-screen bg-muted/30",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-8",children:[e.jsx(n,{className:"h-8 w-48 mb-8"}),e.jsxs("div",{className:"grid lg:grid-cols-[280px_1fr] gap-8",children:[e.jsx(n,{className:"h-64 w-full"}),e.jsx(n,{className:"h-96 w-full"})]})]})}):e.jsxs(e.Fragment,{children:[e.jsxs(U,{children:[e.jsx("title",{children:"Change Password | AIM"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),e.jsx("div",{className:"min-h-screen bg-muted/30",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 md:px-6 py-8",children:[e.jsx(N.h1,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"text-2xl font-bold text-foreground mb-8",children:"Account Settings"}),e.jsxs("div",{className:"grid lg:grid-cols-[280px_1fr] gap-8",children:[e.jsx(D,{}),e.jsxs(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"space-y-6",children:[e.jsxs("div",{className:"bg-background border border-border p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(M,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Change Password"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Update your password to keep your account secure"})]})]}),e.jsxs("form",{onSubmit:k,className:"space-y-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Current Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(c,{type:l?"text":"password",value:y,onChange:s=>p(s.target.value),placeholder:"Enter current password",className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>P(!l),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:l?e.jsx(m,{className:"h-4 w-4"}):e.jsx(x,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(c,{type:i?"text":"password",value:o,onChange:s=>h(s.target.value),placeholder:"Enter new password",className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>S(!i),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:i?e.jsx(m,{className:"h-4 w-4"}):e.jsx(x,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Minimum 6 characters"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Confirm New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(c,{type:d?"text":"password",value:w,onChange:s=>
1f(s.target.value),placeholder:"Confirm new password",className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>C(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:d?e.jsx(m,{className:"h-4 w-4"}):e.jsx(x,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex items-center justify-end pt-4",children:e.jsx(F,{type:"submit",disabled:j,className:"min-w-32",children:j?e.jsx(I,{className:"h-4 w-4 animate-spin"}):"Update Password"})})]})]}),e.jsx("div",{className:"bg-emerald-50 dark:bg-emerald-950/20 border border-emerald-200 dark:border-emerald-800 p-4 rounded-lg",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(T,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-emerald-900 dark:text-emerald-100",children:"Security Tips"}),e.jsxs("ul",{className:"mt-2 text-sm text-emerald-700 dark:text-emerald-300 space-y-1",children:[e.jsx("li",{children:"⢠Use a mix of letters, numbers, and symbols"}),e.jsx("li",{children:"⢠Avoid using personal information"}),e.jsx("li",{children:"⢠Don't reuse passwords from other sites"})]})]})]})})]})]})]})}),e.jsx(H,{})]})};export{ee 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.