2024-12-15 11:27:16 +00:00
|
|
|
"use strict";(()=>{var e={};e.id=7122,e.ids=[3220,7122],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,s){return s in t?t[s]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,s)):"function"==typeof t&&"default"===s?t:void 0}}})},9247:(e,t,s)=>{s.r(t),s.d(t,{config:()=>b,default:()=>E,getServerSideProps:()=>D,getStaticPaths:()=>j,getStaticProps:()=>y,reportWebVitals:()=>A,routeModule:()=>q,unstable_getServerProps:()=>I,unstable_getServerSideProps:()=>M,unstable_getStaticParams:()=>N,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>L});var r={};s.r(r),s.d(r,{default:()=>P,getServerSideProps:()=>v});var n=s(63865),o=s(9455),a=s(30671),i=s(49407),c=s(89600),l=s(8732),u=s(82015),p=s.n(u),m=s(27912),d=s.n(m),g=s(29021),_=s.n(g);s(63715),s(76601);var f=s(32415),S=s(6505),h=s.n(S);let x=s(20048);function P({user:e,query:t}){let s=(0,l.jsxs)(p().Fragment,{children:[(0,l.jsx)("title",{children:"Loging Out | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Login you out"}),(0,l.jsx)("script",{src:"https://accounts.google.com/gsi/client"}),(0,l.jsx)("script",{src:"https://connect.facebook.net/en_US/sdk.js",crossOrigin:"anonymous"})]});return(0,l.jsxs)(p().Fragment,{children:[(0,l.jsx)(d(),{children:s}),(0,l.jsx)("main",{className:"w-screen h-screen flex items-center justify-center p-4 md:p-8",children:(0,l.jsxs)("div",{className:"card max-w-md flex-col items-center bg-white p-6 rounded border border-slate-200 border-solid",children:[(0,l.jsxs)("a",{href:"/",className:"flex items-center gap-2",children:[(0,l.jsx)("img",{src:"/images/logo-icon-alt-2.png",alt:"Logo Icon",width:37}),(0,l.jsx)("span",{className:"font-bold text-2xl",children:"Datasquirel"})]}),(0,l.jsx)("h3",{className:"text-lg m-0 mt-4 text-slate-400",children:"Logging out"}),(0,l.jsx)(f.A,{position:"relative",width:"20px"})]})})]})}async function v({req:e,res:t,query:s}){let r=await x(e,t);if(r){console.log(r.csrf_k);try{let e=process.env.DSQL_USER_LOGIN_KEYS_PATH,t=`${e}/${r.csrf_k}`;console.log("allowedAuthKeyPath",t),_().unlinkSync(t)}catch(e){console.log(`Logout API error: ${e.message}`)}}let{keyCookieName:n,csrfCookieName:o}=h()();return t.setHeader("Set-Cookie",[`${n}=none;max-age=0`,`${o}=null;max-age=0`]),{props:{user:r,logged_out:!0,query:s}}}let E=(0,a.M)(r,"default"),y=(0,a.M)(r,"getStaticProps"),j=(0,a.M)(r,"getStaticPaths"),D=(0,a.M)(r,"getServerSideProps"),b=(0,a.M)(r,"config"),A=(0,a.M)(r,"reportWebVitals"),L=(0,a.M)(r,"unstable_getStaticProps"),O=(0,a.M)(r,"unstable_getStaticPaths"),N=(0,a.M)(r,"unstable_getStaticParams"),I=(0,a.M)(r,"unstable_getServerProps"),M=(0,a.M)(r,"unstable_getServerSideProps"),q=new n.PagesRouteModule({definition:{kind:o.A.PAGES,page:"/logout",pathname:"/logout",bundlePath:"",filename:""},components:{App:c.default,Document:i.default},userland:r})},20048:(e,t,s)=>{s(81630);let r=s(67216),n=s(77463),o=s(29021),a=s(6505);async function i(e,t,s,i){let{keyCookieName:c,csrfCookieName:l}=a();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let m=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!m)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(s&&!o.existsSync(`${m}/${p.csrf_k}`))return null;if(0==p.verification_status&&!s){let e=await r(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=i},76601:(e,t,s)=>{s.d(t,{A:()=>r});async function r(){try{let e=await caches.keys();e[0]&&await Promise.all(e.map(e=>caches.delete(e)))}catch(e){console.log("Error in clearing cache =>",e.message)}}},6505:e=>{e.exports=function(e){let t=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",r=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-cod
|