2025-01-13 08:00:21 +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,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},92192:(e,t,r)=>{r.r(t),r.d(t,{config:()=>A,default:()=>y,getServerSideProps:()=>v,getStaticPaths:()=>E,getStaticProps:()=>j,reportWebVitals:()=>b,routeModule:()=>M,unstable_getServerProps:()=>I,unstable_getServerSideProps:()=>L,unstable_getStaticParams:()=>O,unstable_getStaticPaths:()=>D,unstable_getStaticProps:()=>N});var s={};r.r(s),r.d(s,{default:()=>S,getServerSideProps:()=>P});var n=r(63865),a=r(9455),o=r(30671),i=r(5583),c=r(19796),l=r(8732),u=r(82015),p=r.n(u),d=r(27912),m=r.n(d),g=r(29021),f=r.n(g);r(46169),r(45731);var _=r(16757),h=r(41939);let x=r(92702);function S({user:e,query:t}){let r=(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)(m(),{children:r}),(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)(_.A,{position:"relative",width:"20px"})]})})]})}async function P({req:e,res:t,query:r}){let s=await x(e,t);if(s){console.log(s.csrf_k);try{let e=process.env.DSQL_USER_LOGIN_KEYS_PATH,t=`${e}/${s.csrf_k}`;console.log("allowedAuthKeyPath",t),f().unlinkSync(t)}catch(e){console.log(`Logout API error: ${e.message}`)}}let{keyCookieName:n,csrfCookieName:a}=(0,h.A)();return t.setHeader("Set-Cookie",[`${n}=none;max-age=0`,`${a}=null;max-age=0`]),{props:{user:s,logged_out:!0,query:r}}}let y=(0,o.M)(s,"default"),j=(0,o.M)(s,"getStaticProps"),E=(0,o.M)(s,"getStaticPaths"),v=(0,o.M)(s,"getServerSideProps"),A=(0,o.M)(s,"config"),b=(0,o.M)(s,"reportWebVitals"),N=(0,o.M)(s,"unstable_getStaticProps"),D=(0,o.M)(s,"unstable_getStaticPaths"),O=(0,o.M)(s,"unstable_getStaticParams"),I=(0,o.M)(s,"unstable_getServerProps"),L=(0,o.M)(s,"unstable_getServerSideProps"),M=new n.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/logout",pathname:"/logout",bundlePath:"",filename:""},components:{App:c.default,Document:i.default},userland:s})},92702:(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var s=r(71934),n=r(71205),a=r(29021),o=r.n(a),i=r(41939);async function c(e,t,r){let{keyCookieName:a,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))return null;let l=(0,n.A)({encryptedString:e.cookies[a]});if(!l)return null;let u=JSON.parse(l);if(!u.csrf_k||r&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!o().existsSync(`${p}/${u.csrf_k}`))return null;if(0==u.verification_status&&!r){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}return u?.date&&Date.now()-u.date>6048e5?null:u}},45731:(e,t,r)=>{r.d(t,{A:()=>s});async function s(){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)}}},41939:(e,t,r)=>{r.d(t,{A:()=>s});function s(e){let t=process.env.DSQL_COOKIES_PREFIX||"dsql_",r=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.en
|