PageSourceSearch

https://timereaction.lovable.app/assets/Auth-DMHBlOEi.js

js timereaction.lovable.app collected 2026-10-03 03:52:23 UTC 3,237 bytes, 1 lines download raw bytes

1import{j as s}from"./ui-CBTc1itf.js";import{r as t}from"./vendor-TZW8a3lL.js";import{H as v,J as n}from"./index-BH1jRd0O.js";import{s as i,N as y,B as x}from"./Navigation-BLe4QS4_.js";import{I as l}from"./input-3oU7ZCZx.js";import{L as m}from"./label-Dj54OgO5.js";import{C as b,b as C,c as P,d as L,a as N}from"./card-0bzBhnst.js";import S from"./Footer-BZISeYRf.js";import{c as A}from"./router-jte6i2zQ.js";import"./i18n-DiyWLY3O.js";const T=()=>{const c=A(),[r,f]=t.useState(!0),[u,h]=t.useState(!1),[e,p]=t.useState({email:"",password:"",confirmPassword:""});t.useEffect(()=>{(async()=>{const{data:{session:g}}=await i.auth.getSession();g&&c("/blog-admin")})();const{data:{subscription:a}}=i.auth.onAuthStateChange((g,j)=>{j&&c("/blog-admin")});return()=>a.unsubscribe()},[c]);const w=async o=>{o.preventDefault(),h(!0);try{if(r){const{error:a}=await i.auth.signInWithPassword({email:e.email,password:e.password});if(a)throw a;n.success("Logged in successfully!")}else{if(e.password!==e.confirmPassword){n.error("Passwords do not match");return}const{error:a}=await i.auth.signUp({email:e.email,password:e.password,options:{emailRedirectTo:`${window.location.origin}/blog-admin`}});if(a)throw a;n.success("Account created successfully! Please check your email to confirm your account.")}}catch(a){console.error("Auth error:",a),n.error(a.message||"An error occurred during authentication")}finally{h(!1)}},d=o=>{p({...e,[o.target.name]:o.target.value})};return s.jsxs(s.Fragment,{children:[s.jsxs(v,{children:[s.jsxs("title",{children:[r?"Login":"Sign Up"," - TimeReaction Blog Admin"]}),s.jsx("meta",{name:"description",content:"Access the blog administration panel"})]}),s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(y,{}),s.jsx("div",{className:"container mx-auto px-4 py-16",children:s.jsx("div",{className:"max-w-md mx-auto",children:s.jsxs(b,{children:[s.jsxs(C,{className:"text-center",children:[s.jsx(P,{children:r?"Login":"Sign Up"}),s.jsx(L,{children:r?"Enter your credentials to access the blog admin panel":"Create an account to manage blog posts"})]}),s.jsxs(N,{children:[s.jsxs("form",{onSubmit:w,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(m,{htmlFor:"email",children:"Email"}),s.jsx(l,{id:"email",name:"email",type:"email",value:e.email,onChange:d,required:!0,placeholder:"Enter your email"})]}),s.jsxs("div",{children:[s.jsx(m,{htmlFor:"password",children:"Password"}),s.jsx(l,{id:"password",name:"password",type:"password",value:e.password,onChange:d,required:!0,placeholder:"Enter your password",minLength:6})]}),!r&&s.jsxs("div",{children:[s.jsx(m,{htmlFor:"confirmPassword",children:"Confirm Password"}),s.jsx(l,{id:"confirmPassword",name:"confirmPassword",type:"password",value:e.confirmPassword,onChange:d,required:!0,placeholder:"Confirm your password",minLength:6})]}),s.jsx(x,{type:"submit",className:"w-full",disabled:u,children:u?"Please wait...":r?"Login":"Sign Up"})]}),s.jsx("div",{className:"mt-4 text-center",children:s.jsx(x,{variant:"ghost",onClick:()=>{f(!r),p({email:"",password:"",confirmPassword:""})},className:"text-sm",children:r?"Don't have an account? Sign up":"Already have an account? Login"})})]})]})})}),s.jsx(S,{})]})]})};export{T 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.