PageSourceSearch

https://writoryofficial.com/assets/action-B_8Je0pu.js

js writoryofficial.com collected 2026-10-02 21:32:19 UTC 12,262 bytes, 1 lines download raw bytes

1var k=(d,l,n)=>new Promise((m,h)=>{var x=t=>{try{i(n.next(t))}catch(u){h(u)}},f=t=>{try{i(n.throw(t))}catch(u){h(u)}},i=t=>t.done?m(t.value):Promise.resolve(t.value).then(x,f);i((n=n.apply(d,l)).next())});import{u as C,m as L,j as e,C as g,q as p,v as j,$ as R,ah as I,cZ as S,a1 as y,c_ as E,cW as M,cX as U,cY as V,D as _}from"./index-B6cfMRgy.js";import{r as o}from"./vendor-DliuPpH9.js";function B(){const[,d]=C();L();const[l,n]=o.useState(null),[m,h]=o.useState(null),[x,f]=o.useState(!1);return o.useEffect(()=>{let i=null,t=null;const u=window.location.href,a=new URLSearchParams(window.location.search);if(i=a.get("mode"),t=a.get("oobCode"),!i||!t){const s=window.location.hash;if(s.startsWith("#")){const r=new URLSearchParams(s.substring(1));i=i||r.get("mode"),t=t||r.get("oobCode")}}if(!i||!t){const s=/[?&#]mode=([^&\s]+)/i,r=/[?&#]oobCode=([^&\s]+)/i,c=u.match(s),w=u.match(r);c&&(i=i||decodeURIComponent(c[1])),w&&(t=t||decodeURIComponent(w[1]))}if(!i||!t){const s=u.match(/__\/auth\/action\?(.+)/);if(s){const r=new URLSearchParams(s[1]);i=i||r.get("mode"),t=t||r.get("oobCode")}}n(i),h(t),f(!0)},[]),x?!l||!m?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center py-12 px-4",children:e.jsx(g,{className:"max-w-md w-full",children:e.jsxs(p,{className:"py-8 px-6 text-center",children:[e.jsx("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-wrt-surface rounded-full",children:e.jsx("svg",{className:"w-8 h-8 text-wrt-gold",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Invalid Link"}),e.jsxs("p",{className:"text-gray-600 mb-6",children:["Invalid link. Missing required parameters: ",l?"":"mode ",m?"":"oobCode"]}),e.jsx(j,{onClick:()=>d("/auth"),className:"w-full",children:"Go to Sign In"})]})})}):l==="resetPassword"?e.jsx(W,{oobCode:m}):l==="verifyEmail"?e.jsx(q,{oobCode:m}):e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center py-12 px-4",children:e.jsx(g,{className:"max-w-md w-full",children:e.jsxs(p,{className:"py-8 px-6 text-center",children:[e.jsx("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-red-100 rounded-full",children:e.jsx("svg",{className:"w-8 h-8 text-wrt-gold",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Unknown Action"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"This link is not recognized. Please request a new one or contact support."}),e.jsx(j,{onClick:()=>d("/auth"),className:"w-full",children:"Go to Sign In"})]})})}):e.jsx("div",{className:"min-h-screen bg-wrt-bg flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-wrt-gold mx-auto mb-4"}),e.jsx("p",{children:"Loading..."})]})})}function W({oobCode:d}){const[,l]=C(),{toast:n}=L(),[m,h]=o.useState(!1),[x,f]=o.useState(""),[i,t]=o.useState(""),[u,a]=o.useState(""),[s,r]=o.useState(!1),[c,w]=o.useState(!0);o.useEffect(()=>{k(this,null,function*(){try{w(!0);const b=yield S(y,d);a(b),r(!0),n({title:"Valid Reset Link",description:"Please enter your new password below."})}catch(b){r(!1),n({title:"Invalid or Expired Link",description:"This password reset link is invalid or has expired. Please request a new one.",variant:"destructive"}),setTimeout(()=>l("/auth"),3e3)}finally{w(!1)}})},[d]);const N=v=>k(this,null,function*(){if(v.preventDefault(),!x||x.length<6){n({title:"Invalid Password",description:"Password must be at least 6 characters long.",variant:"destructive"});return}if(x!==i){n({title:"Passwords Don't Match",description:"Please make sure both passwords match.",variant:"destructive"});return}h(!0);try{yield E(y,d,x),n({title:"Password Reset Successful!",description:"Your password has been updated. You can now sign in with your new password."}),setTimeout(()=>{window.location.href="/"},2e3)}catch(b){let P="Failed to reset password. Please try again.";b.code==="auth/weak-password"?P="Password is too weak. Please choose a stronger password.":b.code==="auth/expired-action-code"?P="Reset link has expired. Please request a new one.":b.code==="auth/invalid-action-code"&&(P="Invalid reset link. Please request a new one."),n({title:"Reset Failed",description:P,variant:"destructive"})}finally{h(!1)}});return c?e.jsx("div",{className:"min-h-screen bg-wrt-bg flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-wrt-gold mx-auto mb-4"}),e.jsx("p",{children:"Processing..."})]})}
1):s?e.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"sm:mx-auto sm:w-full sm:max-w-md",children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-20 h-20 mb-4",children:e.jsx("img",{src:R,alt:"Writory Logo",className:"w-full h-full object-contain"})}),e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"WRITORY"}),e.jsx("p",{className:"text-gray-600 text-sm mt-1",children:"WRITE YOUR OWN VICTORY"})]})}),e.jsx("div",{className:"mt-8 sm:mx-auto sm:w-full sm:max-w-md",children:e.jsx(g,{children:e.jsxs(p,{className:"py-8 px-4 sm:px-10",children:[e.jsx("h2",{className:"text-2xl font-semibold text-gray-900 mb-6 text-center",children:"Reset Your Password"}),e.jsx("div",{className:"mb-4 p-3 bg-wrt-surface rounded-lg",children:e.jsxs("p",{className:"text-sm text-wrt-text",children:["Resetting password for: ",e.jsx("strong",{children:u})]})}),e.jsxs("form",{onSubmit:N,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newPassword",className:"block text-sm font-medium text-gray-700",children:"New Password"}),e.jsx(I,{id:"newPassword",type:"password",value:x,onChange:v=>f(v.target.value),placeholder:"Enter your new password",required:!0,minLength:6,className:"mt-1"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Password must be at least 6 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-gray-700",children:"Confirm New Password"}),e.jsx(I,{id:"confirmPassword",type:"password",value:i,onChange:v=>t(v.target.value),placeholder:"Confirm your new password",required:!0,minLength:6,className:"mt-1"})]}),e.jsx(j,{type:"submit",className:"w-full",disabled:m,children:m?"Resetting...":"Reset Password"})]})]})})})]}):e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center py-12 px-4",children:e.jsx(g,{className:"max-w-md w-full",children:e.jsxs(p,{className:"py-8 px-6 text-center",children:[e.jsx("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-red-100 rounded-full",children:e.jsx("svg",{className:"w-8 h-8 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Invalid Reset Link"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"This password reset link is invalid or has expired. Please request a new one."}),e.jsx(j,{onClick:()=>l("/auth"),className:"w-full",children:"Go to Sign In"})]})})})}function q({oobCode:d}){const[,l]=C(),[n,m]=o.useState(!0),[h,x]=o.useState(!1),[f,i]=o.useState(null),{toast:t}=L();return o.useEffect(()=>{k(this,null,function*(){try{console.log("Email Verification Handler: full URL:",window.location.href);let a=null,s=d;if(!a||!s){const r=new URLSearchParams(window.location.search);a=r.get("mode"),s=s||r.get("oobCode")}if(!a||!s){const r=window.location.hash;
1if(r.startsWith("#")){const c=new URLSearchParams(r.substring(1));a=a||c.get("mode"),s=s||c.get("oobCode")}}if(!a||!s){const r=/[?&#]mode=([^&\s]+)/i,c=/[?&#]oobCode=([^&\s]+)/i,w=window.location.href.match(r),N=window.location.href.match(c);w&&(a=a||decodeURIComponent(w[1])),N&&(s=s||decodeURIComponent(N[1]))}if(!a||!s){const r=window.location.href.match(/__\/auth\/action\?(.+)/);if(r){const c=new URLSearchParams(r[1]);a=a||c.get("mode"),s=s||c.get("oobCode")}}if(a==="verifyEmail"&&s)yield M(y,s),yield U(y,s),yield V(y).catch(()=>{}),x(!0),localStorage.removeItem("signup_email"),localStorage.removeItem("signup_password"),localStorage.removeItem("pending_verification_uid"),localStorage.removeItem("showEmailVerification"),localStorage.removeItem("verificationEmail"),_("email_verification_completed",{handler:"firebase_action"}),t({title:"Email Verified!",description:"Your email has been verified. Please sign in to continue."}),setTimeout(()=>{window.location.href="/auth?verified=true"},1500);else throw new Error(`Invalid verification link. Missing required parameters: ${a?"":"mode"} ${s?"":"oobCode"}`)}catch(a){i(a.message||"Failed to verify email"),localStorage.removeItem("signup_email"),localStorage.removeItem("signup_password"),localStorage.removeItem("pending_verification_uid"),t({title:"Verification Failed",description:a.message||"Invalid or expired verification link",variant:"destructive"})}finally{m(!1)}})},[d]),n?e.jsx("div",{className:"min-h-screen bg-wrt-bg flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-wrt-gold mx-auto mb-4"}),e.jsx("p",{children:"Processing..."})]})}):f?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center py-12 px-4",children:e.jsx(g,{className:"max-w-md w-full",children:e.jsxs(p,{className:"py-8 px-6 text-center",children:[e.jsx("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-wrt-surface rounded-full",children:e.jsx("svg",{className:"w-8 h-8 text-wrt-gold",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Verification Failed"}),e.jsx("p",{className:"text-gray-600 mb-6",children:f}),e.jsx(j,{onClick:()=>l("/auth"),className:"w-full",children:"Go to Sign In"})]})})}):h?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center py-12 px-4",children:e.jsx(g,{className:"max-w-md w-full",children:e.jsxs(p,{className:"py-8 px-6 text-center",children:[e.jsx("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-[#f5b21a]/10 border-2 border-[#f5b21a] rounded-full",children:e.jsx("svg",{className:"w-8 h-8 text-[#f5b21a]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:3,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-black",children:"Email Verified!"}),e.jsx("p",{className:"text-gray-700",children:"Your email has been successfully verified. Please sign in with your credentials to access Writory."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(j,{onClick:()=>l("/auth"),className:"w-full",children:"Continue to Sign In"}),e.jsx(j,{onClick:()=>l("/"),variant:"outline",className:"w-full",children:"Go to Home"})]})]})]})})}):e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center py-12 px-4",children:e.jsx(g,{className:"max-w-md w-full",children:e.jsxs(p,{className:"py-8 px-6 text-center",children:[e.jsx("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-wrt-surface rounded-full",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-wrt-gold"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Processing..."}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Please wait while we process your email verification."})]})})})}export{B 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.