PageSourceSearch

https://lesite.fr/assets/PasswordProtectionGate-Dewg98kE.js

js lesite.fr collected 2026-10-04 03:33:10 UTC 2,704 bytes, 1 lines download raw bytes

1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{t as n}from"./jsx-runtime-BdxMnOeJ.js";import{r}from"./i18n-BWPdpnAx.js";import{n as i}from"./client-DAqB3ZqH.js";import{t as a}from"./lazy-toast-DUOtSyIc.js";import{t as o}from"./button-BH1tkkht.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./card-C0QkMdpK.js";import{t as p}from"./lock-CNGHMSrc.js";import{t as m}from"./use-auth-DfNE_amZ.js";import{t as h}from"./input-COr_tgjO.js";import{t as g}from"./label-DukLiyoi.js";var _=e(t(),1),v=n(),y=e=>`site_token_${e}`,b=e=>{if(!e)return!1;try{let[t]=e.split(`.`);if(!t)return!1;let n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`)),{exp:r}=JSON.parse(n);return typeof r==`number`&&r*1e3>Date.now()}catch{return!1}},x=({siteId:e,sitePath:t,children:n})=>{let{isAuthenticated:x,isAdmin:S,loading:C}=m(),w=r(),[T,E]=(0,_.useState)(``),[D,O]=(0,_.useState)(!1),[k,A]=(0,_.useState)(()=>{try{return b(sessionStorage.getItem(y(e)))}catch{return!1}});return(0,_.useEffect)(()=>{let t=()=>{let t=sessionStorage.getItem(y(e));b(t)?A(!0):(t&&sessionStorage.removeItem(y(e)),A(!1))};t();let n=n=>{(n.key===y(e)||n.key===null)&&t()};return window.addEventListener(`storage`,n),()=>window.removeEventListener(`storage`,n)},[e]),k||!C&&x&&S?(0,v.jsx)(v.Fragment,{children:n}):(0,v.jsx)(`div`,{className:`min-h-dvh w-full flex items-center justify-center bg-gradient-to-br from-provence-lavender/20 to-provence-olive/20`,children:(0,v.jsxs)(f,{className:`w-full max-w-md`,children:[(0,v.jsxs)(s,{className:`text-center`,children:[(0,v.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,v.jsx)(`div`,{className:`p-3 bg-provence-lavender/10 rounded-full`,children:(0,v.jsx)(p,{className:`h-8 w-8 text-provence-olive`})})}),(0,v.jsx)(u,{className:`text-2xl`,children:w(`gate.title`)}),(0,v.jsx)(d,{children:w(`gate.description`)})]}),(0,v.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),!D){O(!0);try{let{data:n,error:r}=await i.functions.invoke(`verify-site-password`,{body:{siteId:e,sitePath:t,password:T}});if(r||!n?.token){a.error(w(`gate.wrongPassword`)),E(``);return}sessionStorage.setItem(y(e),n.token),A(!0),a.success(w(`gate.granted`))}catch{a.error(w(`gate.connectionError`))}finally{O(!1)}}},children:[(0,v.jsx)(l,{children:(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(g,{htmlFor:`password`,children:w(`gate.password`)}),(0,v.jsx)(h,{id:`password`,type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:w(`gate.passwordPlaceholder`),required:!0,autoFocus:!0})]})}),(0,v.jsx)(c,{children:(0,v.jsx)(o,{type:`submit`,className:`w-full`,disabled:D,children:w(D?`gate.verifying`:`gate.submit`)})})]})]})})};export{x as t};

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.