PageSourceSearch

https://www.skillplatz.de/assets/Login-BkOdxaog.js

js skillplatz.de collected 2026-10-04 14:39:10 UTC 8,539 bytes, 1 lines download raw bytes

1import{a as O,d as W,e as _,r as l,u as $,f as z,j as e,L as x,t as N,c as H}from"./index-DD47fg2_.js";import{S as D}from"./SuccessModal-DvZLEOUP.js";import{G as J}from"./GoogleAuthButton-BlFubohJ.js";import{A as K}from"./api-BMy3y5ZL.js";function ee(){const{t:s,i18n:k}=O(),[S]=W(),u=_(),[d,E]=l.useState(u.state?.email||""),[h,L]=l.useState(""),[g,C]=l.useState(!1),[p,i]=l.useState(""),[f,b]=l.useState(""),[a,c]=l.useState({}),[Q,w]=l.useState(!1),[A,v]=l.useState(!1),{login:P,loginWithToken:B}=$(),o=z(),M=()=>{v(!1),o("/activities")};l.useEffect(()=>{u.state?.message&&b(u.state.message)},[u.state]);const j=r=>r.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)?"":s("auth.emailInvalid"):s("auth.emailRequired"),y=r=>r?r.length<6?s("auth.passwordTooShort"):"":s("auth.passwordRequired"),q=r=>{E(r.target.value),a.email&&c({...a,email:""})},G=r=>{L(r.target.value),a.password&&c({...a,password:""})},T=()=>{const r=j(d);r&&c({...a,email:r})},F=()=>{const r=y(h);r&&c({...a,password:r})},R=async r=>{r.preventDefault(),i(""),b("");const t={};if(t.email=j(d),t.password=y(h),Object.keys(t).forEach(m=>{t[m]||delete t[m]}),Object.keys(t).length>0){c(t),i(s("auth.fixErrors"));return}const n=await P(d,h);if(n.success){if(N("login",{method:"email"}),n.requiresPasswordReset){o("/reset-password");return}const m=S.get("returnUrl");m?o(decodeURIComponent(m)):n.user?.role==="provider"?o("/provider/dashboard"):n.user?.role==="admin"?o("/admin/dashboard"):o("/")}else n.error==="email_not_verified"?o("/verify-email",{state:{email:d,message:n.message}}):i(n.message)},U=async r=>{try{if(w(!0),i(""),!r?.credential){console.error("Google OAuth error: No credential in response",r),i(s("auth.googleSigninFailed"));return}const t=await H.post(`${K}/api/oauth/google`,{credential:r.credential,role:"parent",language:k.language});t.data.success&&(N("login",{method:"google"}),B(t.data.token,t.data.user),t.data.user.role==="provider"?o("/provider/dashboard"):t.data.user.role==="admin"?o("/admin/dashboard"):t.data.isNewUser?v(!0):o("/"))}catch(t){console.error("Google login error:",t),t.response?.data?.error==="account_exists"?i(s("auth.accountAlreadyExists")):i(t.response?.data?.message||s("auth.googleSigninFailed"))}finally{w(!1)}},I=()=>{console.error("Google OAuth error: Sign-in failed"),i(s("auth.googleSigninFailed"))};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-purple-100 via-pink-50 to-orange-100 py-12 px-4 sm:px-6 lg:px-8 relative overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute top-10 left-10 w-32 h-32 opacity-10 rotate-12 hidden md:block",children:e.jsx("img",{src:"https://images.unsplash.com/photo-1513364776144-60967b0f800f?w=200&auto=format&fit=crop&q=80",alt:"",className:"w-full h-full object-cover rounded-lg grayscale"})}),e.jsx("div",{className:"absolute top-20 right-16 w-40 h-40 opacity-10 -rotate-6 hidden lg:block",children:e.jsx("img",{src:"https://images.unsplash.com/photo-1514320291840-2e0a9bf2a9ae?w=200&auto=format&fit=crop&q=80",alt:"",className:"w-full h-full object-cover rounded-lg grayscale"})}),e.jsx("div",{className:"absolute bottom-16 left-20 w-36 h-36 opacity-10 -rotate-12 hidden lg:block",children:e.jsx("img",{src:"https://images.unsplash.com/photo-1529699211952-734e80c4d42b?w=200&auto=format&fit=crop&q=80",alt:"",className:"w-full h-full object-cover rounded-lg grayscale"})}),e.jsx("div",{className:"absolute bottom-10 right-10 w-32 h-32 opacity-10 rotate-6 hidden md:block",children:e.jsx("img",{src:"https://images.unsplash.com/photo-1508700929628-666bc8bd84ea?w=200&auto=format&fit=crop&q=80",alt:"",className:"w-full h-full object-cover rounded-lg grayscale"})})]}),e.jsx("div",{className:"max-w-md w-full relative z-10",children:e.jsxs("div",{className:"bg-gradient-to-b from-gray-50 to-white rounded-2xl shadow-xl p-6 sm:p-8 backdrop-blur-sm border border-white/50",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-gray-900",children:s("auth.welcomeBack")}),e.jsx("p",{className:"mt-2 text-sm text-gray-600",children:s("auth.loginToContinue")})]}),e.jsx("div",{className:"mb-6",children:e.jsx(J,{onSuccess:U,onError:I,mode:"signin"})}),e.jsxs("div",{className:"relative my-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-gray-300"})}),e.jsx("div",{className:"relative flex justify-center text-sm",children:e.jsx("span",{className:"px-4 bg-white text-gray-500",children:s("auth.orContinueWithEmail")})})]}),e.jsxs("form",{className:"space-y-5",onSubmit:R,children:[f&&e.jsx("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg text-sm",children:f}),p&&e.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm",children:p}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"email",className:"block text-sm font-semibold text-gray-700 mb-1.5",children:[s("auth.email")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{id:"email",name:"email",type:"email",required:!0,className:`block w-full px-4 py-2.5 border-2 rounded-lg shadow-sm focus:outline-none focus:ring-2 transition-all ${a.email?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-200 focus:ring-primary-500 focus:border-primary-500"}`,value:d,onChange:q,onBlur:T,placeholder:"[email protected]"}),a.email&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:a.email})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"password",className:"block text-sm font-semibold text-gray-700 mb-1.5",children:[s("auth.password")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:"password",name:"password",type:g?"text":"password",required:!0,className:`block w-full px-4 py-2.5 pr-10 border-2 rounded-lg shadow-sm focus:outline-none focus:ring-2 transition-all ${a.password?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-200 focus:ring-primary-500 focus:border-primary-500"}`,value:h,onChange:G,onBlur:F,placeholder:"••••••••"}),e.jsx("button",{type:"button",onClick:()=>C(!g),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700 focus:outline-none",tabIndex:"-1",children:g?e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})}):e.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]}),a.password&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:a.password})]}),e.jsx("button",{type:"submit",className:"w-full py-3 px-4 bg-primary-600 text-white rounded-lg text-sm font-semibold hover:bg-primary-700 focus:outline-none shadow-lg hover:shadow-xl transform hover:-translate-y-0.5 transition-all",children:s("auth.loginButton")}),e.jsxs("div",{className:"text-center pt-2 space-y-2",children:[e.jsx(x,{to:"/forgot-password",className:"block text-sm text-gray-600 hover:text-primary-600 font-medium",children:s("auth.forgotPassword")}),e.jsxs(x,{to:"/register",className:"block text-sm text-primary-600 hover:text-primary-800 font-medium",children:[s("auth.noAccount")," ",e.jsx("span",{className:"underline",children:s("auth.signUpHere")}
1)]})]})]}),e.jsx("div",{className:"mt-6 pt-6 border-t border-gray-200 text-center",children:e.jsx(x,{to:"/",className:"text-xs text-gray-600 hover:text-gray-900",children:s("auth.backToHome")})})]})}),e.jsx(D,{isOpen:A,onConfirm:M,title:s("auth.welcomeParent"),message:s("auth.exploreNow"),buttonText:s("auth.exploreActivities"),decorativeIcons:["🎨","🎵","⚽","💻","🎭"],iconType:"success"})]})}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.