PageSourceSearch

https://trocafigurinhas.app/assets/ResetPasswordScreen-5mgIaP7S.js

js trocafigurinhas.app collected 2026-10-06 04:46:17 UTC 5,280 bytes, 1 lines download raw bytes

1import{u as R,h as _,a as n,j as t,d as c,I as E,k as j}from"./index-CIhbGVJX.js";const T=E?"/logo-dev.png":"/logo.png";function U(){return[j.search,window.location.search].filter(Boolean).map(s=>s.startsWith("?")?s.slice(1):s).map(s=>new URLSearchParams(s))}function C(){return[j.hash,window.location.hash].filter(Boolean).map(s=>s.startsWith("#")?s.slice(1):s).map(s=>new URLSearchParams(s))}function u(e){const s=[...C(),...U()];for(const l of s){const a=l.get(e);if(a)return a}return null}function F(){const e=u("next");return!e||!e.startsWith("/")||e.startsWith("//")?null:e}function O(){const e=F();return e||(window.location.pathname==="/lojista"||u("recovery_target")==="lojista"?"/lojista":null)}function m(){try{const e=new URL(window.location.href);e.hash="",e.searchParams.delete("access_token"),e.searchParams.delete("refresh_token"),e.searchParams.delete("expires_at"),e.searchParams.delete("expires_in"),e.searchParams.delete("token_type"),e.searchParams.delete("token_hash"),e.searchParams.delete("type"),e.searchParams.delete("code"),e.searchParams.delete("next"),window.history.replaceState(null,"",`${e.pathname}${e.search}`)}catch{}}async function L(){const e=u("access_token"),s=u("refresh_token");if(e&&s){await c.auth.signOut({scope:"local"}).catch(()=>{});const{data:i,error:o}=await c.auth.setSession({access_token:e,refresh_token:s});if(!o&&i.session)return m(),!0}const l=u("token_hash");if(l){await c.auth.signOut({scope:"local"}).catch(()=>{});const{data:i,error:o}=await c.auth.verifyOtp({token_hash:l,type:"recovery"});if(!o&&i.session)return m(),!0}const a=u("code");if(a){await c.auth.signOut({scope:"local"}).catch(()=>{});const{data:i,error:o}=await c.auth.exchangeCodeForSession(a);if(!o&&i.session)return m(),!0}return!1}function I(){const{t:e}=R(),{clearPasswordRecovery:s,logout:l}=_(),[a,i]=n.useState(""),[o,v]=n.useState(""),[x,f]=n.useState(!1),[p,d]=n.useState(""),[N,S]=n.useState(!1),[g,P]=n.useState(!1),[h,w]=n.useState(!1),[b]=n.useState(()=>O()),y=n.useRef(!1);n.useEffect(()=>{y.current||(y.current=!0,L().then(r=>{if(r){P(!0);return}w(!0)}).catch(()=>{w(!0)}))},[]);const k=async()=>{if(a.length<6){d(e("auth.passwordTooShort"));return}if(a!==o){d(e("auth.passwordsDoNotMatch"));return}f(!0),d("");try{const{error:r}=await c.auth.updateUser({password:a});if(r)throw r;S(!0),b?setTimeout(()=>{s(),window.location.replace(b)},900):setTimeout(()=>void l(),2500)}catch(r){d(r instanceof Error?r.message:e("auth.errorUpdatePassword"))}finally{f(!1)}};return t.jsx("div",{className:"fixed inset-0 z-105 flex items-end justify-center bg-black/50 sm:items-center",children:t.jsxs("div",{className:"w-full overflow-y-auto rounded-t-2xl bg-white shadow-2xl sm:max-w-md sm:rounded-2xl",children:[t.jsxs("div",{className:"bg-linear-to-r from-indigo-600 to-purple-600 p-6 text-center text-white sm:rounded-t-2xl",children:[t.jsx("div",{className:"mx-auto mb-3 h-16 w-16 overflow-hidden rounded-full shadow-lg",children:t.jsx("img",{src:T,alt:"Troca Figurinhas 2026",className:"scale-110"})}),t.jsx("h2",{className:"text-2xl font-black",children:e("app.name")}),t.jsx("p",{className:"text-sm opacity-90",children:e("auth.resetPasswordTitle")})]}),t.jsxs("div",{className:"space-y-4 p-6",children:[!g&&!h&&t.jsxs("div",{className:"flex flex-col items-center gap-3 py-4",children:[t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-indigo-200 border-t-indigo-600"}),t.jsx("p",{className:"text-sm text-gray-500",children:e("auth.preparingReset")})]}),h&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"rounded-lg bg-red-50 p-4 text-center",children:[t.jsx("p",{className:"font-semibold text-red-700",children:e("auth.recoveryExpired")}),t.jsx("p",{className:"mt-1 text-sm text-red-600",children:e("auth.recoveryExpiredHint")})]}),t.jsx("button",{onClick:s,className:"w-full rounded-xl bg-indigo-600 py-3 font-bold text-white shadow-lg transition hover:bg-indigo-700",children:e("auth.requestNewLink")})]}),g&&!h&&(N?t.jsxs("div",{className:"rounded-lg bg-green-50 p-4 text-center",children:[t.jsx("p",{className:"font-semibold text-green-700",children:e("auth.passwordUpdated")}),t.jsx("p",{className:"mt-1 text-sm text-green-600",children:e("auth.passwordUpdatedHint")})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"mb-1 block text-sm font-medium text-gray-700",children:e("auth.newPassword")}),t.jsx("input",{type:"password",value:a,onChange:r=>{i(r.target.value),d("")},placeholder:"********",className:"w-full rounded-xl border-2 border-gray-200 p-3 transition outline-none focus:border-indigo-500"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1 block text-sm font-medium text-gray-700",children:e("auth.confirmNewPassword")}),t.jsx("input",{type:"password",value:o,onChange:r=>{v(r.target.value),d("")},placeholder:"********",className:"w-full rounded-xl border-2 border-gray-200 p-3 transition outline-none focus:border-indigo-500"})]}),p&&t.jsx("p",{className:"text-sm text-red-500",children:p}),t.jsx("button",{onClick:k,disabled:x||!a||!o,className:"w-full rounded-xl bg-indigo-600 py-3 font-bold text-white shadow-lg transition hover:bg-indigo-700 disabled:opacity-50",children:e(x?"auth.saving":"auth.saveNewPassword")})]}))]})]})})}export{I 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.