(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4024],{7688:function(e,a,s){Promise.resolve().then(s.bind(s,1245))},1245:function(e,a,s){"use strict";s.r(a),s.d(a,{default:function(){return l}});var r=s(7437),n=s(2265),t=s(8706);function l(){let e=(0,t.T)(),[a,s]=(0,n.useState)(""),[l,i]=(0,n.useState)(""),[u,o]=(0,n.useState)(""),[d,c]=(0,n.useState)(""),[m,g]=(0,n.useState)(""),[f,p]=(0,n.useState)(!1);async function h(r){if(r.preventDefault(),c(""),g(""),l!==u){c(e("password_mismatch",{defaultValue:"Fjalekalimi i ri nuk perputhet."}));return}p(!0);try{let r=await fetch("/api/password/change",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:a,password:l})}),n=await r.json();n.success?(g(e("password_changed",{defaultValue:"Fjalekalimi u ndryshua me sukses."})),s(""),i(""),o("")):c(n.message||e("error",{defaultValue:"Gabim."}))}catch(a){c(e("generic_error",{defaultValue:"Ndodhi nje gabim."}))}finally{p(!1)}}return(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-2xl font-bold mb-6",children:e("change_password",{defaultValue:"Ndrysho Fjalekalimin"})}),(0,r.jsxs)("div",{className:"bg-white rounded-xl p-6 shadow-sm max-w-lg",children:[d&&(0,r.jsx)("div",{className:"bg-red-50 text-red-600 p-3 rounded-lg mb-4 text-sm",children:d}),m&&(0,r.jsx)("div",{className:"bg-green-50 text-green-600 p-3 rounded-lg mb-4 text-sm",children:m}),(0,r.jsxs)("form",{onSubmit:h,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e("current_password",{defaultValue:"Fjalekalimi aktual"})}),(0,r.jsx)("input",{type:"password",value:a,onChange:e=>s(e.target.value),required:!0,className:"w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-orange-500 focus:border-transparent outline-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e("new_password",{defaultValue:"Fjalekalimi i ri"})}),(0,r.jsx)("input",{type:"password",value:l,onChange:e=>i(e.target.value),required:!0,minLength:6,className:"w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-orange-500 focus:border-transparent outline-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e("confirm_password",{defaultValue:"Konfirmo fjalekalimin"})}),(0,r.jsx)("input",{type:"password",value:u,onChange:e=>o(e.target.value),required:!0,minLength:6,className:"w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-orange-500 focus:border-transparent outline-none"})]}),(0,r.jsx)("button",{type:"submit",disabled:f,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-orange-300 text-white font-semibold px-6 py-3 rounded-lg transition-colors",children:f?e("saving",{defaultValue:"Duke ruajtur..."}):e("change_password",{defaultValue:"Ndrysho Fjalekalimin"})})]})]})]})}}},function(e){e.O(0,[8706,2971,2117,1744],function(){return e(e.s=7688)}),_N_E=e.O()}]);