PageSourceSearch

https://cyparta.com/assets/ResetPassword-NLp-i0ay.js

js cyparta.com collected 2026-10-02 01:27:47 UTC 8,271 bytes, 1 lines download raw bytes

1import{a as e,u as s,r as a,j as t,L as r}from"./vendor-DdjWeKhn.js";import{u as l,a as o,C as i,g as n}from"./index-DVNfcHhn.js";import{a as d}from"./accountAr-B8phKkDY.js";import{T as c}from"./Toast-DsbQGKHg.js";import{m}from"./animations-BiTprZVg.js";import{aD as x,a5 as u,at as h,Q as p,j as w,A as g,S as f}from"./icons-BCa0xwjb.js";const b=()=>{const{lang:b,isAr:j,dir:y,href:v}=l(),N=e=>d(e,j),P=e(),D=s(),[C,S]=o({threshold:.1}),[k,E]=a.useState(null),[T,A]=a.useState(!1),[F,B]=a.useState(!1),[R,z]=a.useState(!1),[q,L]=a.useState({password:"",confirmPassword:""}),[M,Y]=a.useState({score:0,feedback:[]}),Z=D.state?.email,Q=D.state?.code,U=D.state?.verified;a.useEffect(()=>{U&&Z&&Q||P(v("/forgot-password"))},[U,Z,Q,P]);const W=e=>{const{name:s,value:a}=e.target;L(e=>({...e,[s]:a})),"password"===s&&X(a)},X=e=>{let s=0;const a=[];e.length>=8?s++:a.push("At least 8 characters"),/[a-z]/.test(e)?s++:a.push("Lowercase letter"),/[A-Z]/.test(e)?s++:a.push("Uppercase letter"),/\d/.test(e)?s++:a.push("Number"),/[^a-zA-Z0-9]/.test(e)?s++:a.push("Special character"),Y({score:s,feedback:a})};return U&&Z&&Q?t.jsxs("div",{className:"min-h-screen pt-20 bg-[#0B0B0B] relative overflow-hidden",dir:y,lang:b,children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#D80027]/5 via-transparent to-purple-900/5"}),t.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml,%3Csvg width=%2260%22 height=%2260%22 viewBox=%220 0 60 60%22 xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cg fill=%22none%22 fill-rule=%22evenodd%22%3E%3Cg fill=%22%23D80027%22 fill-opacity=%220.03%22%3E%3Ccircle cx=%2230%22 cy=%2230%22 r=%221%22/%3E%3C/g%3E%3C/g%3E%3C/svg%3E')]"}),t.jsx("div",{className:"container mx-auto px-6 py-20 relative z-10",children:t.jsxs("div",{className:"max-w-md mx-auto",children:[t.jsxs(m.div,{initial:{opacity:0,y:-50},animate:{opacity:1,y:0},transition:{duration:.8},className:"text-center mb-12",children:[t.jsx("div",{className:"flex justify-center mb-8",children:t.jsxs("div",{className:"relative",children:[t.jsx(i,{variant:"full",className:"h-16 w-auto text-[#F5F5F5]",style:{filter:"drop-shadow(0 0 20px rgba(216, 0, 39, 0.6))"}}),t.jsx("div",{className:"absolute inset-0 bg-[#D80027]/20 rounded-full blur-xl opacity-50 scale-150"})]})}),t.jsx("div",{className:"flex justify-center mb-6",children:t.jsx("div",{className:"p-4 bg-[#D80027]/20 rounded-full",children:t.jsx(x,{className:"w-8 h-8 text-[#D80027]"})})}),t.jsxs("h1",{className:"text-4xl font-bold text-white mb-4",children:[N("Create New"),t.jsx("span",{className:"text-[#D80027]",children:N("Password")})]}),t.jsx("p",{className:"text-gray-300 text-lg mb-2",children:N("Enter your new password for")}),t.jsx("p",{className:"text-[#D80027] font-semibold",children:Z})]}),t.jsxs(m.div,{ref:C,initial:{opacity:0,y:50},animate:S?{opacity:1,y:0}:{},transition:{duration:.8,delay:.2},className:"bg-white/5 backdrop-blur-md rounded-2xl p-8 border border-white/10 shadow-2xl",children:[t.jsxs("form",{onSubmit:async e=>{if(e.preventDefault(),!q.password||!q.confirmPassword)return E({message:"❌ Please fill in all fields.",type:"error"}),void setTimeout(()=>E(null),3e3);if(q.password!==q.confirmPassword)return E({message:"❌ Passwords do not match.",type:"error"}),void setTimeout(()=>E(null),3e3);if(M.score<3)return E({message:"❌ Please choose a stronger password.",type:"error"}),void setTimeout(()=>E(null),3e3);try{z(!0),await n.resetPassword({email:Z,code:Q,password:q.password,confirm_password:q.confirmPassword}),E({message:"🎉 Password reset successfully! You can now sign in.",type:"success"}),setTimeout(()=>E(null),3e3),setTimeout(()=>P(v("/login")),1500)}catch(s){const e=s&&"object"==typeof s&&"message"in s?String(s.message):"Failed to reset password. Please try again.";E({message:`❌ ${e}`,type:"error"}),setTimeout(()=>E(null),4e3)}finally{z(!1)}},className:"space-y-6",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:N("New Password")}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:t.jsx(u,{className:"h-5 w-5 text-gray-400"})}),t.jsx("input",{type:T?"text":"password",name:"password",value:q.password,onChange:W,className:"w-full pl-10 pr-12 py-3 bg-white/10 border border-gray-700 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-[#D80027] focus:ring-2 focus:ring-[#D80027]/20 transition-all",placeholder:N("Enter new password"),required:!0,disabled:R}),t.jsx("button",{type:"button",onClick:()=>A(!T),className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-white transition-colors",disabled:R,children:T?t.jsx(h,{className:"h-5 w-5"}):t.jsx(p,{className:"h-5 w-5"})})]}),q.password&&t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[t.jsx("div",{className:"flex-1 bg-gray-700 rounded-full h-2",children:t.jsx("div",{className:"h-2 rounded-full transition-all duration-300 "+(M.score<=1?"bg-red-500":M.score<=3?"bg-yellow-500":"bg-green-500"),style:{width:M.score/5*100+"%"}})}),t.jsx("span",{className:"text-xs font-medium "+(M.score<=1?"text-red-400":M.score<=3?"text-yellow-400":"text-green-400"),children:M.score<=1?"Weak":M.score<=3?"Medium":"Strong"})]}),M.feedback.length>0&&t.jsxs("p",{className:"text-xs text-gray-400",children:["Missing: ",M.feedback.join(", ")
1]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:N("Confirm New Password")}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:t.jsx(u,{className:"h-5 w-5 text-gray-400"})}),t.jsx("input",{type:F?"text":"password",name:"confirmPassword",value:q.confirmPassword,onChange:W,className:"w-full pl-10 pr-12 py-3 bg-white/10 border border-gray-700 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-[#D80027] focus:ring-2 focus:ring-[#D80027]/20 transition-all",placeholder:N("Confirm new password"),required:!0,disabled:R}),t.jsx("button",{type:"button",onClick:()=>B(!F),className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-white transition-colors",disabled:R,children:F?t.jsx(h,{className:"h-5 w-5"}):t.jsx(p,{className:"h-5 w-5"})})]}),q.confirmPassword&&q.password!==q.confirmPassword&&t.jsx("p",{className:"mt-1 text-xs text-red-400",children:N("Passwords do not match")})]}),t.jsx("button",{type:"submit",disabled:R||M.score<3||q.password!==q.confirmPassword,className:"w-full flex items-center justify-center space-x-3 py-3 px-6 rounded-lg font-semibold transition-all duration-300 "+(R||M.score<3||q.password!==q.confirmPassword?"bg-gray-600 text-gray-400 cursor-not-allowed":"bg-[#D80027] text-white hover:bg-[#D80027]/90 transform hover:scale-105 shadow-lg hover:shadow-[#D80027]/25"),children:R?t.jsxs(t.Fragment,{children:[t.jsx(m.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-5 h-5 border-2 border-gray-400 border-t-white rounded-full"}),t.jsx("span",{children:N("Resetting...")})]}):t.jsxs(t.Fragment,{children:[t.jsx(w,{className:"w-5 h-5"}),t.jsx("span",{children:N("Reset Password")}),t.jsx(g,{className:"w-5 h-5 rtl:rotate-180"})]})})]}),t.jsx("div",{className:"mt-8 text-center",children:t.jsxs("p",{className:"text-gray-400",children:["Remember your password?"," ",t.jsx(r,{to:"/login",className:"text-[#D80027] hover:text-white transition-colors font-semibold",children:N("Sign in here")})]})})]}),t.jsx(m.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.4},className:"mt-8 bg-white/5 backdrop-blur-md rounded-xl p-6 border border-white/10",children:t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(f,{className:"w-6 h-6 text-[#D80027]"}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-white font-semibold",children:N("Secure Password Reset")}),t.jsx("p",{className:"text-gray-400 text-sm",children:N("Your new password will be encrypted and stored securely")})]})]})})]})}),k&&t.jsx(c,{message:k.message,type:k.type})]}):null};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.