PageSourceSearch

https://ledmania.gr/assets/Auth-CfWYnstI.js

js ledmania.gr collected 2026-10-07 22:01:54 UTC 7,085 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-query-BBe9Uaw0.js";import{d as S,r as o,L as C}from"./vendor-react-62vuNXVr.js";import{Z as P,s as m}from"./index-BXxlNWgv.js";import{E as q}from"./eye-off-BGJxjHSi.js";import{E as F}from"./eye-Crx7XhJ7.js";import"./vendor-ui-BgyuxuNv.js";import"./vendor-supabase-XMQjZQ6V.js";import"./vendor-zustand-CmnBNWkc.js";function M(){const w=S(),[r,c]=o.useState("login"),[i,j]=o.useState(""),[l,v]=o.useState(""),[x,y]=o.useState(""),[g,N]=o.useState(""),[d,k]=o.useState(!1),[f,p]=o.useState(!1),[b,a]=o.useState(null),[h,n]=o.useState(null),E=async s=>{s.preventDefault(),a(null),n(null),p(!0);try{if(r==="login"){const{error:t}=await m.auth.signInWithPassword({email:i,password:l});if(t)throw t;w("/account")}else if(r==="signup"){if(l!==x)throw new Error("Οι κωδικοί δεν ταιριάζουν");if(l.length<6)throw new Error("Ο κωδικός πρέπει να έχει τουλάχιστον 6 χαρακτήρες");const{error:t}=await m.auth.signUp({email:i,password:l,options:{data:{full_name:g},emailRedirectTo:window.location.origin}});if(t)throw t;n("Ελέγξτε το email σας για επιβεβαίωση λογαριασμού.")}else if(r==="forgot"){const{error:t}=await m.auth.resetPasswordForEmail(i,{redirectTo:`${window.location.origin}/reset-password`});if(t)throw t;n("Σας στείλαμε email για επαναφορά κωδικού.")}}catch(t){const u=t instanceof Error?t.message:"Κάτι πήγε στραβά";u.includes("Invalid login credentials")?a("Λανθασμένο email ή κωδικός."):u.includes("User already registered")?a("Υπάρχει ήδη λογαριασμός με αυτό το email."):a(u)}finally{p(!1)}};return e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-2xl border border-border shadow-sm p-8",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:e.jsx(P,{className:"h-7 w-7 text-primary"})})}),e.jsxs("h1",{className:"text-2xl font-bold text-center text-foreground mb-1",children:[r==="login"&&"Σύνδεση",r==="signup"&&"Δημιουργία Λογαριασμού",r==="forgot"&&"Επαναφορά Κωδικού"]}),e.jsxs("p",{className:"text-sm text-center text-muted-foreground mb-4",children:[r==="login"&&"Συνδεθείτε για Αγαπημένα & Αποθηκευμένα Προϊόντα",r==="signup"&&"Δημιουργήστε λογαριασμό για Αγαπημένα & Αποθηκευμένα",r==="forgot"&&"Εισάγετε το email σας για επαναφορά"]}),r!=="forgot"&&e.jsxs("p",{className:"text-xs text-center text-muted-foreground/70 mb-6",children:["Για παραγγελίες χρησιμοποιήστε την"," ",e.jsx(C,{to:"/account",className:"text-primary hover:underline",children:"αναζήτηση παραγγελίας"})," ","με email & αριθμό παραγγελίας."]}),b&&e.jsx("div",{className:"mb-4 p-3 bg-destructive/10 border border-destructive/20 rounded-xl text-sm text-destructive",children:b}),h&&e.jsx("div",{className:"mb-4 p-3 bg-badge-new/10 border border-badge-new/20 rounded-xl text-sm text-badge-new",children:h}),e.jsxs("form",{onSubmit:E,className:"space-y-4",children:[r==="signup"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5",children:"Ονοματεπώνυμο"}),e.jsx("input",{type:"text",value:g,onChange:s=>N(s.target.value),required:!0,placeholder:"π.χ. Γιάννης Παπαδόπουλος",className:"w-full h-11 px-3 rounded-xl border border-border bg-background text-foreground text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary transition-colors"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5",children:"Email"}),e.jsx("input",{type:"email",value:i,onChange:s=>j(s.target.value),required:!0,placeholder:"[email protected]",className:"w-full h-11 px-3 rounded-xl border border-border bg-background text-foreground text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focu
1s:border-primary transition-colors"})]}),r!=="forgot"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5",children:"Κωδικός"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:d?"text":"password",value:l,onChange:s=>v(s.target.value),required:!0,placeholder:"Τουλάχιστον 6 χαρακτήρες",className:"w-full h-11 px-3 pr-10 rounded-xl border border-border bg-background text-foreground text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary transition-colors"}),e.jsx("button",{type:"button",onClick:()=>k(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",children:d?e.jsx(q,{className:"h-4 w-4"}):e.jsx(F,{className:"h-4 w-4"})})]})]}),r==="signup"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5",children:"Επιβεβαίωση Κωδικού"}),e.jsx("input",{type:d?"text":"password",value:x,onChange:s=>y(s.target.value),required:!0,placeholder:"Επαναλάβετε τον κωδικό",className:"w-full h-11 px-3 rounded-xl border border-border bg-background text-foreground text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary transition-colors"})]}),r==="login"&&e.jsx("div",{className:"text-right",children:e.jsx("button",{type:"button",onClick:()=>{c("forgot"),a(null),n(null)},className:"text-xs text-primary hover:underline",children:"Ξεχάσατε τον κωδικό;"})}),e.jsx("button",{type:"submit",disabled:f,className:"w-full h-11 bg-primary text-primary-foreground rounded-xl font-semibold text-sm hover:bg-primary/90 transition-colors disabled:opacity-60 disabled:cursor-not-allowed",children:f?"Παρακαλώ περιμένετε...":r==="login"?"Σύνδεση":r==="signup"?"Δημιουργία Λογαριασμού":"Αποστολή Email"})]}),e.jsx("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:r==="login"?e.jsxs(e.Fragment,{children:["Δεν έχετε λογαριασμό;"," ",e.jsx("button",{onClick:()=>{c("signup"),a(null),n(null)},className:"text-primary font-semibold hover:underline",children:"Εγγραφή"})]}):e.jsxs(e.Fragment,{children:["Έχετε ήδη λογαριασμό;"," ",e.jsx("button",{onClick:()=>{c("login"),a(null),n(null)},className:"text-primary font-semibold hover:underline",children:"Σύνδεση"})]})})]})})})}export{M 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.