1import{m as i,k as e}from"./BSYLsQ-1.js";import{B as O,k2 as $,kb as ee,hE as te,iE as D,hL as se,ja as ae,jb as re,ir as ie,dm as B,k as I,m as R,ad as j,aN as ne,J as z,cZ as oe,cS as le,gR as ce,aq as me,ar as de,cF as ue,eP as xe}from"./C1VBpTXZ.js";import{C as ge,e as fe}from"./DoCfxlfF.js";import"./DlPWDibz.js";import"./DjlRatrT.js";import"./SFk0Fnst.js";const G="/Home/ForgotPassword";function c(s,r){for(const o of r){const n=s[o];if(typeof n=="string"&&n.trim())return n}}function U(s){if(!s||typeof s!="object")return{};const r=s;return{title:c(r,["title","Title","pageTitle","PageTitle"]),description:c(r,["description","Description","subTitle","SubTitle"]),emailLabel:c(r,["emailLabel","EmailLabel","emailArea","EmailArea"]),emailPlaceholder:c(r,["emailPlaceholder","EmailPlaceholder","emailAreaPlaceholder","EmailAreaPlaceholder"]),submitButtonLabel:c(r,["submitButtonLabel","SubmitButtonLabel","buttonLabel","ButtonLabel"])}}function he(s){return!s||typeof s!="object"?null:c(s,["captchaKey","CaptchaKey"])??null}async function pe(s){return O.get(G,{params:{domain:s}})}async function be(s){return O.post(G,s)}const v="/InfinityElearning_logo.png",ye="© 2024 Infinity Yazılım. Tüm hakları saklıdır.";function _(s,r){var x,l;const n=(l=(x=s.response)==null?void 0:x.data)==null?void 0:l.message;return typeof n=="string"&&n.trim()?n:r}function Pe(){var F,A;const s=$(),[r]=ee(),o=i.useMemo(()=>{const t=te(r);return t?D(t):typeof window<"u"?D(window.location.origin):""},[r]),[n,x]=i.useState(""),[l,k]=i.useState(!1),[M,K]=i.useState(!1),[N,m]=i.useState(""),[H,p]=i.useState(!0),[g,f]=i.useState(""),[d,b]=i.useState(()=>U(void 0)),[S,L]=i.useState(null),[u,W]=i.useState({}),y=i.useCallback(async()=>{if(!o.trim()){f("Domain bilgisi bulunamadı. Lütfen geçerli bir adresle açın."),p(!1);return}p(!0),f(""),se(o.trim()).then(t=>{if(t.success===!1)return;const a=ae(t);W({logoUrl:a.standard.logoUrl,footerText:a.standard.footerText,customLogin:a.customLogin,custom:a.custom,buttonColor:re(a.customLogin,a.custom,a.standard)})}).catch(()=>{});try{const t=await pe(o.trim());if(t.success===!1){f(typeof t.message=="string"&&t.message.trim()?t.message:"Sayfa yüklenirken bir hata oluÅtu."),b({});return}b(U(t.data)),L(he(t.data))}catch(t){f(_(t,"Sayfa yüklenirken bir hata oluÅtu.")),b({}),L(null)}finally{p(!1)}},[o]);i.useEffect(()=>{y()},[y]);const w=d.title??"Åifremi Unuttum",Y=d.description??"E-posta adresinizi veya sicil numaranızı girin, size Åifre sıfırlama bilgisi gönderelim",q=d.emailLabel??"E-posta veya Sicil No",J=d.emailPlaceholder??"E-posta adresi veya sicil no",Q=d.submitButtonLabel??"Åifremi Sıfırla",Z=((F=u.logoUrl)==null?void 0:F.trim())||v,P=((A=u.footerText)==null?void 0:A.trim())||ye,E=ie(u.buttonColor),V=u.customLogin===!0,X=async t=>{if(t.preventDefault(),m(""),!n.trim()){m("E-posta veya sicil numarası gereklidir");return}if(!o.trim()){m("Domain bilgisi eksik.");return}k(!0);try{let a;S&&(a=await fe(S,"forgotpassword")??void 0);const h=await be({Domain:o.trim(),Email:n.trim(),...a?{RecaptchaResponse:a}:{}});if(h.success===!1){m(typeof h.message=="string"&&h.message.trim()?h.message:"İÅlem baÅarısız oldu. Lütfen tekrar deneyin.");return}K(!0)}catch(a){m(_(a,"İÅlem sırasında bir hata oluÅtu."))}finally{k(!1)}},C=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-6 flex justify-center",children:e.jsx("img",{src:Z,alt:"",className:"h-24 w-auto max-w-[280px] object-contain",onError:t=>{const a=t.currentTarget;a.src.endsWith(v)||(a.src=v)}})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"mb-2 text-2xl font-semibold text-gray-900 dark:text-slate-50",children:w}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-slate-300",children:Y})]}),H?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-10",children:[e.jsx(B,{className:"h-8 w-8 animate-spin text-red-700"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Yükleniyor..."})]}):e.jsxs(e.Fragment,{children:[g?e.jsxs(I,{variant:"destructive",className:"border-red-200",children:[e.jsx(R,{children:g}),e.jsx(j,{type:"button",variant:"outline",className:"mt-3 w-full",onClick:()=>void y(),children:"Tekrar dene"})]}):null,N&&e.jsx(I,{variant:"destructive",className:"border-red-200",children:e.jsx(R,{children:N})}),M?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3 py-6",children:[e.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:e.jsx(ne,{className:"h-8 w-8 text-green-600 dark:text-green-400"})}),e.jsx("p",{className:"text-center text-slate-700 dark:text-slate-300",children:"Åifre sıfırlama bilgisi kayıtlı e-posta adresinize veya SMS ile cep telefonu numaranıza gönderildi."})]}),e.jsxs(j,{onClick:()=>s("/auth/login"),variant:"outline",className:"h-11 w-full",children:[e.jsx(z,{className:"mr-2 h-4 w-4"}),"GiriÅ Sayfasına Dön"]})]}):e.jsxs("form",{onSubmit:X,className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{htmlFor:"email",className:"text-sm font-normal text-gray-900 dark:text-slate-50",children:q}),e.jsx(le,{id:"email",type:"text",inputMode:"text",autoComplete:"username",placeholder:J,value:n,onChange:t=>x(t.target.value),className:"h-11 border border-gray-300 bg-white text-gray-900 dark:text-slate-50 focus:border-red-700 focus:ring-1 focus:ring-red-700",disabled:l||!!g})]}),e.jsx(j,{type:"submit",className:ce("h-11 w-full border-0 font-normal text-white shadow-none",E?"hover:opacity-[0.92]":xe),style:E,disabled:l||!!g,children:l?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"mr-2 h-4 w-4 animate-spin"}),"Gönderiliyor..."]}):Q}),e.jsx("div",{className:"text-center",children:e.jsxs("button",{type:"button",onClick:()=>
1s("/auth/login"),className:"inline-flex cursor-pointer items-center gap-1 text-sm text-gray-700 dark:text-slate-300 transition-all hover:text-red-700 hover:underline",children:[e.jsx(z,{className:"h-3 w-3"}),"Geri"]})})]})]})]})]}),T=e.jsxs(ue,{children:[e.jsxs("title",{children:[w," - Infinity LMS"]}),e.jsx("meta",{name:"description",content:"Åifrenizi sıfırlayın"})]});return V?e.jsxs(e.Fragment,{children:[T,e.jsxs(ge,{custom:u.custom??{},children:[C,e.jsx("div",{className:"mt-6 border-t border-slate-200/70 pt-4 text-center text-xs text-slate-600 dark:text-slate-300",children:P})]})]}):e.jsxs(e.Fragment,{children:[T,e.jsx("div",{className:"flex min-h-[100dvh] flex-col overflow-y-auto bg-gradient-to-br from-slate-300 via-slate-100 to-slate-300 p-4 dark:from-slate-950 dark:via-slate-900 dark:to-slate-950",children:e.jsxs("div",{className:"relative z-10 m-auto w-full max-w-md",children:[e.jsx(me,{className:"border border-white/60 shadow-xl shadow-slate-300/30 backdrop-blur-xl dark:border-slate-700/60",style:{backgroundColor:"rgba(255, 255, 255, 0.72)"},children:e.jsx(de,{className:"px-6 py-7 sm:px-8 sm:py-8",children:C})}),e.jsx("div",{className:"mt-6 text-center text-xs text-slate-500 dark:text-slate-400",children:e.jsx("p",{children:P})})]})})]})}export{Pe as ForgotPasswordPage};
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.