PageSourceSearch

https://fokus-cockpit.lovable.app/assets/Auth-gmGdVEB6.js

js fokus-cockpit.lovable.app collected 2026-10-03 03:31:45 UTC 15,007 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DutRv0PK.js","assets/index-C9ebdKB5.js","assets/index-B3l7RpuC.css"])))=>i.map(i=>d[i]);
2import{au as pe,r,j as e,B as j,t as p,av as fe,T as ve,G as be,I as je,a4 as we,a1 as c,Q as w}from"./index-C9ebdKB5.js";import{L as u,I as f}from"./label-mUns6IyZ.js";import{a as te}from"./alert-dialog-DC8lUvR1.js";import{T as Ne,a as ye,b as A,c as T}from"./tabs-CntS2C33.js";import{C as Ce}from"./card-DR5LKJwI.js";import{F as ke}from"./FokusLogo-6nlbNsOi.js";import{F as Se}from"./Footer-sQ8iIHWy.js";import{A as Ee}from"./AppResetButton-CuxnvRZo.js";import{u as Me}from"./use-noindex-DdM6NeEV.js";import{E as Pe}from"./eye-off-COus09Go.js";import{E as Le}from"./eye-BbN4TZWF.js";import"./index-DfOTqTrH.js";const H=/^\+49\d{9,12}$/,M=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Fe(i){let n=0;return i.length>=8&&n++,/[A-Z]/.test(i)&&/[a-z]/.test(i)&&n++,/\d/.test(i)&&/[^A-Za-z0-9]/.test(i)&&n++,[{score:0,label:"zu kurz",color:"bg-muted"},{score:1,label:"schwach",color:"bg-destructive"},{score:2,label:"mittel",color:"bg-yellow-500"},{score:3,label:"stark",color:"bg-green-500"}][n]}function D({id:i,value:n,onChange:m,placeholder:a,autoComplete:P,invalid:b,valid:L,required:N,minLength:y}){const[h,C]=r.useState(!1);return e.jsxs("div",{className:"relative",children:[e.jsx(f,{id:i,type:h?"text":"password",value:n,onChange:g=>m(g.target.value),placeholder:a,autoComplete:P,required:N,minLength:y,className:p("pr-10 h-11 md:h-10",b&&"border-destructive focus-visible:ring-destructive",L&&"border-green-500 focus-visible:ring-green-500")}),e.jsx(fe,{delayDuration:200,children:e.jsxs(ve,{children:[e.jsx(be,{asChild:!0,children:e.jsx("button",{type:"button",onClick:()=>C(g=>!g),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,"aria-label":h?"Passwort verbergen":"Passwort anzeigen",children:h?e.jsx(Pe,{className:"h-4 w-4"}):e.jsx(Le,{className:"h-4 w-4"})})}),e.jsx(je,{children:h?"Passwort verbergen":"Passwort anzeigen"})]})})]})}function We(){Me();const i=pe(),[n,m]=r.useState("login"),[a,P]=r.useState(""),[b,L]=r.useState(""),[N,y]=r.useState(!1),[h,C]=r.useState(!0),[g,ne]=r.useState(""),[_,ae]=r.useState(""),[v,ie]=r.useState(""),[x,le]=r.useState(""),[l,oe]=r.useState(""),[k,ce]=r.useState(""),[V,B]=r.useState(!1),[G,de]=r.useState(!0),ue=r.useMemo(()=>typeof window>"u"?null:new URLSearchParams(window.location.search).get("ref"),[]),[d,me]=r.useState(""),O=r.useRef(null),W=r.useRef(null),q=r.useRef(null);r.useEffect(()=>{const s=localStorage.getItem("fokus-stay-logged-in");s!==null&&C(s==="1")},[]),r.useEffect(()=>{const s=setTimeout(()=>{var t,o,se;n==="login"?(t=O.current)==null||t.focus():n==="register"?(o=W.current)==null||o.focus():n==="reset"&&((se=q.current)==null||se.focus())},50);return()=>clearTimeout(s)},[n]);function F(){localStorage.setItem("fokus-stay-logged-in",h?"1":"0")}const U=a.length>0&&(M.test(a)||H.test(a)),Z=a.length>0&&!U,I=v.length>0&&M.test(v),$=v.length>0&&!I,z=x.length>0&&H.test(x),K=x.length>0&&!z,R=r.useMemo(()=>Fe(l),[l]),S=l.length>=8,X=l.length>0&&l===k,J=k.length>0&&l!==k,Q=g.trim().length>0&&(I||z)&&S&&X,E=d.length>0&&(M.test(d)||H.test(d)),Y=d.length>0&&!E;async function ee(){try{F();const{lovable:s}=await we(async()=>{const{lovable:o}=await import("./index-DutRv0PK.js");return{lovable:o}},__vite__mapDeps([0,1,2])),t=await s.auth.signInWithOAuth("google",{redirect_uri:`${window.location.origin}/`,extraParams:{prompt:"select_account"}});if(t.error){c.error("Google-Login fehlgeschlagen",{description:t.error.message||String(t.error)});return}}catch(s){c.error("Google-Login fehlgeschlagen",{description:s.message})}}async function ge(s){s.preventDefault(),y(!0),F();try{const t=a.startsWith("+"),{error:o}=t?await w.auth.signInWithPassword({phone:a,password:b}):await w.auth.signInWithPassword({email:a,password:b});if(o)throw o;i("/",{replace:!0})}catch(t){c.error("Login fehlgeschlagen",{description:t.message})}finally{y(!1)}}async function he(s){if(s.preventDefault(),!!Q){B(!0),F();try{const t={password:l,options:{data:{vorname:g.trim(),nachname:_.trim()||null,phone:x||null,newsletter_optin:G,signup_source:ue},emailRedirectTo:`${window.location.origin}/`}};v&&(t.email=v),x&&(t.phone=x);const{error:o}=await w.auth.signUp(t);if(o)throw o;c.success("Account erstellt! Du bist eingeloggt."),i("/",{replace:!0})}catch(t){c.error("Registrierung fehlgeschlagen",{description:t.message})}finally{B(!1)}}}async function xe(s){if(s.preventDefault(),!E)return c.error("Gültige E-Mail oder Handynummer eingeben");if(M.test(d)){const{error:t}=await w.auth.resetPasswordForEmail(d,{redirectTo:`${window.location.origin}/reset-password`});t?c.error(t.message):c.success("Reset-Mail gesendet – schau in dein Postfach")}else{const{error:t}=await w.auth.signInWithOtp({phone:d});t?c.error(t.message):c.success("Code per SMS gesendet")}}return e.jsxs("div",{className:"min-h-screen bg-gradient-hero flex flex-col items-center justify-center px-4 py-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6 text-hero-foreground",children:[e.jsx(ke,{size:56}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-3xl",children:"FOKUS Cockpit"}),e.jsx("p",{className:"text-sm opacity-80",children:"Fokus . Macht . Cashflow"})]})]}),e.jsxs(Ce,{className:"w-full max-w-md p-6 shadow-elevated",children:[e.jsxs("div",{className:"mb-5",children:[n==="login"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl mb-1",children:"Willkommen bei FOKUS Cockpit"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Bring Dich in Fokus. Sammle Punkte für erledigte Aufgaben, steige durch 30 Heldenstufen, verdiene Belohnungen. Logge Dich ein oder erstelle einen neuen Account."})]}),n==="register"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl mb-1",children:"Lege Dir einen Account an"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Vorname + E-Mail oder Handynummer – das reicht."})]}),n==="reset"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl mb-1",children:"Passwort vergessen?"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Gib Deine E-Mail oder Handynummer ein – wir senden Dir einen Link bzw. Code zum Zurücksetzen."})]})]}),e.jsxs(Ne,{value:n,onValueChange:m,children:[e.jsxs(ye,{className:"grid grid-cols-3 w-full",children:[e.jsx(A,{value:"login",children:"Login"}),e.jsx(A,{value:"register",children:"Registrieren"}),e.jsx(A,{value:"reset",children:"Reset"})]}
2),e.jsxs(T,{value:"login",className:"space-y-4 mt-4",children:[e.jsxs(j,{type:"button",variant:"outline",className:"w-full",onClick:ee,children:[e.jsx(re,{})," ",e.jsx("span",{className:"ml-2",children:"Mit Google anmelden"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"h-px flex-1 bg-border"})," oder ",e.jsx("div",{className:"h-px flex-1 bg-border"})]}),e.jsxs("form",{onSubmit:ge,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(u,{htmlFor:"loginId",children:"E-Mail oder Handynummer"}),e.jsx(f,{ref:O,id:"loginId",value:a,onChange:s=>P(s.target.value),placeholder:"[email protected] oder +491701234567",required:!0,inputMode:a.startsWith("+")?"tel":"email",autoComplete:"username",className:p("h-11 md:h-10",Z&&"border-destructive focus-visible:ring-destructive",U&&"border-green-500 focus-visible:ring-green-500")}),Z&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:"Bitte gültige E-Mail oder Handynummer (+49…)"})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"loginPw",children:"Passwort"}),e.jsx(D,{id:"loginPw",value:b,onChange:L,autoComplete:"current-password",required:!0})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(te,{"aria-label":"Eingeloggt bleiben",checked:h,onCheckedChange:s=>C(!!s)}),e.jsx("span",{children:"Eingeloggt bleiben"})]}),e.jsx(j,{type:"submit",className:"w-full bg-gradient-brand",disabled:N,children:N?"Einloggen...":"Einloggen"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5 pt-2 text-sm text-center",children:[e.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>m("reset"),children:"Passwort vergessen?"}),e.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>m("register"),children:"Noch keinen Account? Hier registrieren"}),e.jsx("a",{href:"/?tab=hilfe",className:"text-muted-foreground hover:underline text-xs",children:"Anleitung & Hilfe"})]})]}),e.jsxs(T,{value:"register",className:"space-y-4 mt-4",children:[e.jsxs(j,{type:"button",variant:"outline",className:"w-full",onClick:ee,children:[e.jsx(re,{})," ",e.jsx("span",{className:"ml-2",children:"Mit Google registrieren"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"h-px flex-1 bg-border"})," oder ",e.jsx("div",{className:"h-px flex-1 bg-border"})]}),e.jsxs("form",{onSubmit:he,className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(u,{htmlFor:"vn",children:"Vorname *"}),e.jsx(f,{ref:W,id:"vn",value:g,onChange:s=>ne(s.target.value),required:!0,autoComplete:"given-name",className:p("h-11 md:h-10",g.trim()&&"border-green-500 focus-visible:ring-green-500")})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"nn",children:"Nachname"}),e.jsx(f,{id:"nn",value:_,onChange:s=>ae(s.target.value),autoComplete:"family-name",className:"h-11 md:h-10"})]})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"em",children:"E-Mail (oder Handynummer)"}),e.jsx(f,{id:"em",type:"email",inputMode:"email",autoComplete:"email",value:v,onChange:s=>ie(s.target.value),placeholder:"[email protected]",className:p("h-11 md:h-10",$&&"border-destructive focus-visible:ring-destructive",I&&"border-green-500 focus-visible:ring-green-500")}),$&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:"E-Mail-Format ungültig"})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"ph",children:"Handynummer (Format +49…)"}),e.jsx(f,{id:"ph",type:"tel",inputMode:"tel",autoComplete:"tel",value:x,onChange:s=>le(s.target.value),placeholder:"+491701234567",className:p("h-11 md:h-10",K&&"border-destructive focus-visible:ring-destructive",z&&"border-green-500 focus-visible:ring-green-500")}),K&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:"Format: +49 gefolgt von 9–12 Ziffern"})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"pw",children:"Passwort (min. 8 Zeichen)"}),e.jsx(D,{id:"pw",value:l,onChange:oe,autoComplete:"new-password",required:!0,minLength:8,invalid:l.length>0&&!S,valid:S}),l.length>0&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3].map(s=>e.jsx("div",{className:p("h-1.5 flex-1 rounded-full transition-colors",s<=R.score?R.color:"bg-muted")},s))}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Stärke: ",R.label]})]})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"pw2",children:"Passwort bestätigen"}),e.jsx(D,{id:"pw2",value:k,onChange:ce,autoComplete:"new-password",required:!0,minLength:8,invalid:J,valid:X&&S}),J&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:"Passwörter stimmen nicht überein"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Mind. eines von E-Mail/Handynummer ist Pflicht. Beide sind möglich."}),e.jsxs("label",{className:"flex items-start gap-2 text-sm cursor-pointer pt-1",children:[e.jsx(te,{"aria-label":"Newsletter: Tipps und Updates per E-Mail erhalten",checked:G,onCheckedChange:s=>de(!!s),className:"mt-0.5"}),e.jsx("span",{className:"leading-snug",children:"Ja, ich möchte gelegentlich Tipps und Updates per E-Mail von Daniel bekommen."})]}),e.jsxs("p",{className:"text-xs text-muted-foreground leading-snug pt-1",children:["Mit dem Anlegen des Accounts akzeptierst Du unsere"," ",e.jsx("a",{href:"https://www.liebezeitarbeit.com/agb",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"AGB"})," ","und bestätigst, die"," ",e.jsx("a",{href:"https://www.liebezeitarbeit.com/widerruf",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"Widerrufsbelehrung"})," ","sowie die"," ",e.jsx("a",{href:"/datenschutz",className:"underline hover:text-foreground",children:"Datenschutzerklärung"})," ","gelesen zu haben."]}),e.jsx(j,{type:"submit",className:"w-full bg-gradient-brand",disabled:V||!Q,children:V?"Anlegen...":"Account anlegen"})]}),e.jsx("div",{className:"flex flex-col gap-1.5 pt-2 text-sm text-center",children:e.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>m("login"),children:"Schon einen Account? Hier einloggen"})})]}
2),e.jsxs(T,{value:"reset",className:"space-y-4 mt-4",children:[e.jsxs("form",{onSubmit:xe,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(u,{htmlFor:"re",children:"E-Mail oder Handynummer"}),e.jsx(f,{ref:q,id:"re",value:d,onChange:s=>me(s.target.value),required:!0,inputMode:d.startsWith("+")?"tel":"email",autoComplete:"username",placeholder:"[email protected] oder +491701234567",className:p("h-11 md:h-10",Y&&"border-destructive focus-visible:ring-destructive",E&&"border-green-500 focus-visible:ring-green-500")}),Y&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:"Bitte gültige E-Mail oder Handynummer eingeben"})]}),e.jsx(j,{type:"submit",className:"w-full bg-gradient-brand",disabled:!E,children:"Reset anfordern"})]}),e.jsx("div",{className:"flex flex-col gap-1.5 pt-2 text-sm text-center",children:e.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>m("login"),children:"Zurück zum Login"})})]})]})]}),e.jsxs("div",{className:"mt-6 flex flex-col items-center gap-2",children:[e.jsx("p",{className:"text-xs text-hero-foreground/70",children:"Login funktioniert nicht? App zurücksetzen:"}),e.jsx(Ee,{variant:"outline",size:"sm",label:"App zurücksetzen"})]}),e.jsx("div",{className:"text-hero-foreground/80 mt-6",children:e.jsx(Se,{})})]})}function re(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 48 48","aria-hidden":"true",children:[e.jsx("path",{fill:"#FFC107",d:"M43.6 20.5H42V20H24v8h11.3c-1.6 4.6-6 8-11.3 8-6.6 0-12-5.4-12-12s5.4-12 12-12c3 0 5.8 1.1 7.9 3l5.7-5.7C34 6.1 29.3 4 24 4 12.9 4 4 12.9 4 24s8.9 20 20 20 20-8.9 20-20c0-1.2-.1-2.3-.4-3.5z"}),e.jsx("path",{fill:"#FF3D00",d:"M6.3 14.7l6.6 4.8C14.7 16 19 13 24 13c3 0 5.8 1.1 7.9 3l5.7-5.7C34 6.1 29.3 4 24 4 16.3 4 9.7 8.3 6.3 14.7z"}),e.jsx("path",{fill:"#4CAF50",d:"M24 44c5.2 0 9.9-2 13.5-5.2l-6.2-5.3C29.4 35 26.8 36 24 36c-5.3 0-9.7-3.4-11.3-8l-6.5 5C9.5 39.6 16.2 44 24 44z"}),e.jsx("path",{fill:"#1976D2",d:"M43.6 20.5H42V20H24v8h11.3c-.8 2.3-2.3 4.2-4.2 5.5l6.2 5.3C40.9 35.6 44 30.3 44 24c0-1.2-.1-2.3-.4-3.5z"})]})}export{We 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.