"use strict";(()=>{var e={};e.id=6712,e.ids=[3220,6712],e.modules={30671:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},70852:(e,r,t)=>{t.r(r),t.d(r,{config:()=>A,default:()=>x,getServerSideProps:()=>y,getStaticPaths:()=>L,getStaticProps:()=>E,reportWebVitals:()=>N,routeModule:()=>R,unstable_getServerProps:()=>j,unstable_getServerSideProps:()=>Q,unstable_getStaticParams:()=>b,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>P});var s={};t.r(s),t.d(s,{default:()=>h,getServerSideProps:()=>v});var n=t(63865),i=t(9455),a=t(30671),o=t(5583),c=t(53881),l=t(8732),u=t(82015),p=t.n(u),d=t(92702),m=t(16757),S=t(46169),_=t(71205),f=t(26228),g=t(77047),D=t(71934);function h({user:e,verified:r}){let[t,s]=p().useState(!1),[n,i]=p().useState(null);return r?(0,l.jsx)(f.A,{head:(0,l.jsxs)(p().Fragment,{children:[(0,l.jsx)("title",{children:"Verify Email Address"}),(0,l.jsx)("meta",{name:"description",content:"Verify your email address"})]}),user:e,children:(0,l.jsx)("main",{className:"flex items-center justify-center w-full p-8",children:(0,l.jsx)("div",{className:"login-block gap-2",children:(0,l.jsxs)("div",{className:"flex items-center gap-4",children:[(0,l.jsx)("img",{src:"/images/checkmark.svg",alt:"check-mark",width:30}),(0,l.jsx)("span",{className:"text-xl",children:"Email Verification Successfull!"})]})})})}):(0,l.jsx)(p().Fragment,{children:(0,l.jsx)(f.A,{head:(0,l.jsxs)(p().Fragment,{children:[(0,l.jsx)("title",{children:"Verify Email Address"}),(0,l.jsx)("meta",{name:"description",content:"Verify your email address"})]}),user:e,children:(0,l.jsx)("main",{className:"flex flex-col items-center p-8 justify-center w-full",children:(0,l.jsxs)("div",{className:"login-block gap-2 flex-col max-w-lg",children:[n&&(0,l.jsx)("div",{className:n.class+" w-full rounded py-2 px-4 flex justify-center",children:n.msg}),t&&(0,l.jsx)(m.A,{position:"absolute"}),(0,l.jsx)("h1",{className:"text-2xl m-0 ",children:"Verify Email Address"}),(0,l.jsx)("span",{children:"Please click the button below to send verification link"}),(0,l.jsx)("button",{className:"w-full",onClick:function(e){e.preventDefault(),s(!0),(0,S.A)("/api/sendEmailVerificationLink").then(e=>{s(!1),e.success&&i({msg:"Email Sent. Please check mailbox",class:"bg-emerald-100"})})},children:(0,l.jsx)("span",{children:"Send Verification Link"})}),(0,l.jsx)("button",{className:"w-full outlined",onClick:e=>{window.history.back()},children:(0,l.jsx)("span",{children:"Go Back"})})]})})})})}async function v({req:e,res:r,query:t}){let s;let n=!1;try{s=await (0,d.A)(e,r);let i=t?.token;if(i){let e=(0,_.A)({encryptedString:i.toString()});if(e)try{s=JSON.parse(e)}catch(e){(0,g.A)({component:"email-verification/index-page-component/getServerSideProps/line-255",message:e.message,user:{}}),s=null,i=null}}if(!s)return{redirect:{destination:"/logout",permanent:!1}};if(s.verification_status?.toString().match(/^[1-5]$/))return{redirect:{destination:"/admin",permanent:!1}};let a=await (0,D.A)(`SELECT id FROM users WHERE verification_status > 0 AND id='${s.id}'`);if(a&&a[0])return{redirect:{destination:"/admin",permanent:!1}};if(s?.dateCode){let e=s.dateCode;Date.now()-parseInt(e)>18e5?(s=null,i=null):(await (0,D.A)(`UPDATE users SET verification_status='1' WHERE id='${s.id}'`),n=!0)}}catch(e){return(0,g.A)({component:"email-verification/index-page-component/getServerSideProps/main-catch-error",message:e.message,user:{}}),{redirect:{destination:"/logout",permanent:!1}}}return{props:{user:s,verified:n}}}let x=(0,a.M)(s,"default"),E=(0,a.M)(s,"getStaticProps"),L=(0,a.M)(s,"getStaticPaths"),y=(0,a.M)(s,"getServerSideProps"),A=(0,a.M)(s,"config"),N=(0,a.M)(s,"reportWebVitals"),P=(0,a.M)(s,"unstable_getStaticProps"),O=(0,a.M)(s,"unstable_getStaticPaths"),b=(0,a.M)(s,"unstable_getStaticParams"),j=(0,a.M)(s,"unstable_getServerProps"),Q=(0,a.M)(s,"unstable_getServerSideProps"),R=new n.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/email-verification",pathname:"/email-verification",bundlePath:"",filename:""},components:{App:c.default,Document:o.default},userland:s})},60149:(e,r,t)=>{t.d(r,{On:()=>n.a,Yv:()=>a.a,_n:()=>c}),t(76102);var s=t(65967),n=t.n(s),i=t(30889),a=t.n(i),o=t(93726);let c=t.n(o)()},92702:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(39383),n=t.n(s),i=t(60149);async function a(e,r,t,s){let a=n()({req:e,level:t?"deep":void 0}),o={DSQL_REMOTE_SQL_HOST:process.env.DSQL_REMOTE_SQL_HOST,DSQL_SU_USER_ID:process.env.DSQL_SU_USER_ID,DSQL_HOST_ENV:process.env.DSQL_HOST_ENV,DSQL_HOST:process.env.DSQL_HOST,DSQL_STATIC_HOST:process.env.DSQL_STATIC_HOST,DSQL_GOOGLE_CLIENT_ID:process.env.DSQL_GOOGLE_CLIENT_ID,DSQL_TINY_MCE_API_KEY:process.env.DSQL_TINY_MCE_API_KEY};return s&&a.payload?.id&&(0,i._n)(process.env.DSQL_SU_USER_ID)!==a.payload.id?{user:null,appData:o}:{user:a.payload,appData:o}}},77047:(e,r,t)=>{t.d(r,{A:()=>i});var s=t(29021),n=t.n(s);async function i({user:e,message:r,component:t,noMail:s,req:i}){let a=new Date,o=(()=>{if(!i)return null;try{let e=i.headers["x-forwarded-for"],r=i.headers["x-real-ip"],t=i.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||i.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR =========================== Error Message: ${r} Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=` User Id: ${e?.id} User Name: ${e?.first_name} ${e?.last_name} User Email: ${e?.email}`),i?.url&&(s+=` URL: ${i.url}`),i?.body&&(s+=` Request Body: ${JSON.stringify(i.body,null,4)}`),o&&(s+=` IP: ${o}`),s+=` Date: ${a.toDateString()} ========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let c=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",s),n().appendFileSync("./.tmp/error.log",` ${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},71205:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(55511),n=t(79428),i=t(48243);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:a,salt:o,keyLen:c,algorithm:l,bufferAllocSize:u}=(0,i.A)({encryptionKey:r});if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let p=(0,s.scryptSync)(a,o,c),d=n.Buffer.alloc(u,0),m=(0,s.createDecipheriv)(l,p,d);try{let r=m.update(e,"hex","utf8");return r+=m.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},71934:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(51779);async function n(...e){let r=(0,s.A)();try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},51779:(e,r,t)=>{t.d(r,{A:()=>i});var s=t(9973),n=t.n(s);function i(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||n()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||n()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||n()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||n()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},48243:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?function(e,r){try{let r=Number(e);if("number"!=typeof r||isNaN(r))return 0;return Math.round(r)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},5583:(e,r,t)=>{t.r(r),t.d(r,{default:()=>i});var s=t(8732);t(82015);var n=t(20883);function i(){return(0,s.jsxs)(n.Html,{lang:"en",children:[(0,s.jsxs)(n.Head,{children:[(0,s.jsx)("meta",{name:"author",content:"Datasquirel"}),(0,s.jsx)("meta",{name:"Copyright",content:`Copyright (c) ${new Date().getFullYear()} Datasquirel`}),process.env.NEXT_PUBLIC_DSQL_HOST_ENV?.match(/dev/)&&(0,s.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,s.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com/",crossOrigin:"anonymous"}),(0,s.jsx)("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),(0,s.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Poppins"}),(0,s.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Inter"}),(0,s.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=IBM+Plex+Mono"}),(0,s.jsx)("script",{src:"/scripts/themeSelector.js"}),(0,s.jsx)("meta",{httpEquiv:"Content-Type",content:"text/html; charset=UTF-8"}),(0,s.jsx)("meta",{property:"og:site_name",content:"DATASQUIREL"}),(0,s.jsx)("meta",{property:"og:type",content:"website"}),(0,s.jsx)("meta",{name:"twitter:card",content:"summary"}),(0,s.jsx)("meta",{property:"og:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,s.jsx)("meta",{itemProp:"image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,s.jsx)("meta",{name:"twitter:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,s.jsx)("link",{rel:"stylesheet",href:"/styles/prism.css"}),(0,s.jsx)("script",{src:"/scripts/prism.js",async:!0}),(0,s.jsx)("script",{dangerouslySetInnerHTML:{__html:"var DSQL = {}"}})]}),(0,s.jsxs)("body",{children:[(0,s.jsx)(n.Main,{}),(0,s.jsx)(n.NextScript,{})]})]})}},9455:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},76102:e=>{e.exports=require("@moduletrace/datasquirel/dist/client")},13893:e=>{e.exports=require("@moduletrace/datasquirel/dist/client/fetch")},39383:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/actions/users/user-auth")},65967:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/ejson")},93726:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/numberfy")},30889:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/slugify")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")}};var r=require("../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[883,9821,3881],()=>t(70852));module.exports=s})();