PageSourceSearch

https://francnumerique.netlify.app/assets/Register-RGehJJ0s.js

js francnumerique.netlify.app collected 2026-10-03 10:45:07 UTC 7,508 bytes, 1 lines download raw bytes

1import{u as z,d as V,j as e,L as D,E as k,a as C}from"./index-BDkIXZro.js";import{r as i,u as M,i as I,L as T}from"./vendor-DaxRCwWg.js";import{q as H,t as O,w as Q,x as Z}from"./firebase-Cv3R1fLt.js";import{u as B}from"./i18n-ZJY9W6Px.js";import{A as G}from"./alert-circle-CZp-S-71.js";function ee(){const[g,S]=i.useState(""),[l,R]=i.useState(""),[n,q]=i.useState(""),[p,E]=i.useState(""),[u,y]=i.useState(""),[o,m]=i.useState(null),[f,t]=i.useState(""),[b,P]=i.useState(!1),[w,L]=i.useState(!1),{signUp:U}=z(),$=M(),{t:s}=B(),[A]=I();i.useEffect(()=>{const r=A.get("ref");r&&(y(r.toUpperCase()),N(r.toUpperCase()))},[]);const j=r=>{const a=r.length>=8,x=/[A-Z]/.test(r),d=/[a-z]/.test(r),h=/\d/.test(r),v=/[!@#$%^&*(),.?":{}|<>]/.test(r);return{minLength:a,hasUpperCase:x,hasLowerCase:d,hasNumbers:h,hasSpecialChar:v,isValid:a&&x&&d&&h&&v}},N=async r=>{if(!r){m(null),t("");return}try{const a=H(V,"users"),x=O(a,Q("referralCode","==",r)),d=await Z(x);if(d.empty)m(null),r.length>0?t("Code de parrainage invalide"):t("");else{const h=d.docs[0].data();m(h.nickname||"Anonyme"),t("")}}catch(a){console.error("Error checking referral code:",a),m(null),t("Erreur lors de la vérification du code")}},F=()=>p.trim()?/\S+@\S+\.\S+/.test(g)?j(l).isValid?l!==n?(t(s("auth.register.errors.passwordMismatch")),!1):u&&!o?(t("Code de parrainage invalide"),!1):!0:(t(s("auth.register.errors.invalidPassword")),!1):(t(s("auth.register.errors.invalidEmail")),!1):(t(s("auth.register.errors.nicknameRequired")),!1),_=async r=>{if(r.preventDefault(),t(""),!!F())try{await U(g,l,p,o?u:void 0),$("/dashboard",{replace:!0})}catch(a){if(a?.code)switch(a.code){case"auth/email-already-in-use":t(s("auth.register.errors.emailInUse"));break;case"auth/weak-password":t(s("auth.register.errors.weakPassword"));break;case"auth/invalid-email":t(s("auth.register.errors.invalidEmail"));break;default:t(s("auth.register.errors.generic"))}else a.message==="nickname_taken"?t(s("auth.register.errors.nicknameTaken")):t(s("auth.register.errors.unexpected"))}},c=j(l);return e.jsxs("div",{className:"min-h-screen bg-gray-900 flex flex-col items-center justify-center px-4",children:[e.jsx("div",{className:"absolute top-4 right-4",children:e.jsx(D,{})}),e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("img",{src:"https://0d20715ab7.clvaw-cdnwnd.com/33ae15b445e1f4c8edc400f1cd92e4c5/200000050-5d5115d512/700/Design_sans_titre__22_-removebg-preview.webp?ph=0d20715ab7",alt:"FRANC NUMERIQUE",className:"w-24 h-24 mx-auto mb-6"}),e.jsx("h1",{className:"text-3xl font-bold text-white mb-2",children:s("auth.register.title")}),e.jsx("p",{className:"text-gray-400",children:s("auth.register.subtitle")})]}),f&&e.jsxs("div",{className:"bg-red-500/10 border border-red-500 text-red-500 rounded-lg p-3 text-sm mb-6 flex items-start gap-2",children:[e.jsx(G,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),e.jsx("span",{children:f})]}),e.jsxs("form",{onSubmit:_,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"nickname",className:"block text-sm font-medium text-gray-400",children:[s("auth.register.nickname"),":"]}),e.jsx("input",{id:"nickname",type:"text",value:p,onChange:r=>E(r.target.value),className:"mt-1 block w-full rounded-lg bg-gray-800 border-gray-700 text-white px-4 py-2.5",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-400",children:[s("auth.register.email"),":"]}),e.jsx("input",{id:"email",type:"email",value:g,onChange:r=>S(r.target.value),className:"mt-1 block w-full rounded-lg bg-gray-800 border-gray-700 text-white px-4 py-2.5",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"referral-code",className:"block text-sm font-medium text-gray-400",children:"Code de parrainage (optionnel):"}),e.jsx("input",{id:"referral-code",type:"text",value:u,onChange:r=>{const a=r.target.value.toUpperCase();y(a),N(a)},className:`mt-1 block w-full rounded-lg bg-gray-800 border-gray-700 text-white px-4 py-2.5 ${o?"border-green-500":f&&u?"border-red-500":""}`,placeholder:"Code de parrainage"}),o&&e.jsxs("p",{className:"mt-1 text-sm text-green-500",children:["Parrainé par: ",o]})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-400",children:[s("auth.register.password"),":"]}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("input",{id:"password",type:b?"text":"password",value:l,onCh
1ange:r=>R(r.target.value),className:"block w-full rounded-lg bg-gray-800 border-gray-700 text-white px-4 py-2.5 pr-10",required:!0}),e.jsx("button",{type:"button",onClick:()=>P(!b),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-300",children:b?e.jsx(k,{size:20}):e.jsx(C,{size:20})})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx("p",{className:"text-xs text-gray-400",children:s("auth.register.passwordRequirements.title")}),e.jsxs("ul",{className:"space-y-1 text-xs",children:[e.jsxs("li",{className:`flex items-center gap-2 ${c.minLength?"text-green-500":"text-gray-400"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),s("auth.register.passwordRequirements.minLength")]}),e.jsxs("li",{className:`flex items-center gap-2 ${c.hasUpperCase?"text-green-500":"text-gray-400"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),s("auth.register.passwordRequirements.uppercase")]}),e.jsxs("li",{className:`flex items-center gap-2 ${c.hasLowerCase?"text-green-500":"text-gray-400"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),s("auth.register.passwordRequirements.lowercase")]}),e.jsxs("li",{className:`flex items-center gap-2 ${c.hasNumbers?"text-green-500":"text-gray-400"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),s("auth.register.passwordRequirements.number")]}),e.jsxs("li",{className:`flex items-center gap-2 ${c.hasSpecialChar?"text-green-500":"text-gray-400"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),s("auth.register.passwordRequirements.special")]})]})]})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"confirm-password",className:"block text-sm font-medium text-gray-400",children:[s("auth.register.confirmPassword"),":"]}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("input",{id:"confirm-password",type:w?"text":"password",value:n,onChange:r=>q(r.target.value),className:`block w-full rounded-lg bg-gray-800 border-gray-700 text-white px-4 py-2.5 pr-10 ${n&&l!==n?"ring-2 ring-red-500":""}`,required:!0}),e.jsx("button",{type:"button",onClick:()=>L(!w),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-300",children:w?e.jsx(k,{size:20}):e.jsx(C,{size:20})})]}),n&&l!==n&&e.jsx("p",{className:"mt-1 text-xs text-red-500",children:s("auth.register.errors.passwordMismatch")})]}),e.jsx("button",{type:"submit",className:"w-full flex justify-center py-2.5 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:s("auth.register.submit")})]}),e.jsxs("p",{className:"mt-6 text-center text-sm text-gray-400",children:[s("auth.register.alreadyHaveAccount")," ",e.jsx(T,{to:"/login",className:"text-blue-500 hover:text-blue-400",children:s("auth.register.login")})]})]})]})}export{ee as Register};

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.