dsql-admin/dsql-app/.local_dist/server/pages/send-password-reset-link.js
Benjamin Toby 7a06e83a46 Updates
2024-12-08 20:56:57 +01:00

1 line
11 KiB
JavaScript

"use strict";(()=>{var e={};e.id=6827,e.ids=[636,6827],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}}})},67097:(e,t,s)=>{s.r(t),s.d(t,{config:()=>A,default:()=>q,getServerSideProps:()=>D,getStaticPaths:()=>b,getStaticProps:()=>E,reportWebVitals:()=>N,routeModule:()=>C,unstable_getServerProps:()=>L,unstable_getServerSideProps:()=>I,unstable_getStaticParams:()=>k,unstable_getStaticPaths:()=>M,unstable_getStaticProps:()=>w});var r={};s.r(r),s.d(r,{SendPassResetContext:()=>v,default:()=>P,getServerSideProps:()=>j});var i=s(63865),a=s(9455),n=s(30671),o=s(49407),l=s(68268),u=s(8732),c=s(82015),p=s.n(c),m=s(71457),d=s(87472),x=s(32415),h=s(20048),f=s.n(h),g=s(63715),S=s(13002),_=s(49240);function y({message:e}){return(0,u.jsxs)("div",{className:"info gray",children:[(0,u.jsx)(_.A,{fontSize:"small",color:"inherit",className:"opacity-50 text-gray-600"}),(0,u.jsx)("span",{className:"font-normal",children:e})]})}let v=p().createContext({});function P(e){let t="Cloudbased SQL data management system | Datasquirel",s="Datasquirel is a fast and efficient cloud-based SQL data management system that takes away the entire hassle of dealing with data both locally and across different platforms.",r=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("title",{children:t}),(0,u.jsx)("meta",{name:"description",content:s}),(0,u.jsx)(d.A,{pageTitle:t,pageDescription:s,pagePathname:"/"})]}),[i,a]=p().useState(!1),[n,o]=p().useState(!1);return(0,u.jsx)(m.A,{head:r,user:e.user,children:(0,u.jsx)(v.Provider,{value:{user:e.user},children:(0,u.jsx)("main",{children:(0,u.jsxs)("section",{children:[i&&(0,u.jsx)(x.A,{}),n?(0,u.jsx)(S.A,{message:"Email Sent. Please check your email address and follow the link provided",className:"whitespace-nowrap"}):(0,u.jsx)("div",{className:"paper",children:(0,u.jsxs)("div",{className:"max-w-xl flex-col items-stretch",children:[(0,u.jsx)("h1",{className:"m-0 text-4xl",children:"Send Password Reset Link"}),(0,u.jsx)("span",{children:"Please enter your email address to receive a password reset link"}),(0,u.jsxs)("form",{className:"w-full flex flex-col items-stretch gap-4",onSubmit:e=>{a(!0),e.preventDefault();let t=e.target["email-address"].value;(0,g.A)(`/api/sendPasswordResetLink?email=${t}`).then(e=>{console.log(e),setTimeout(()=>{a(!1)},500),e.success&&o(!0)})},children:[(0,u.jsx)("input",{type:"text",autoComplete:"email",name:"email-address",id:"email-address",className:"w-full",placeholder:"Email Address",defaultValue:e?.user?.logged_in_status?e.user.email:"",required:!0}),(0,u.jsx)("button",{children:"Send password reset Email"}),(0,u.jsx)(y,{message:"Please note that this link will expire after 1 hour"})]})]})})]})})})})}async function j({req:e,res:t}){let s=await f()(e,t);return s?.social_login?{redirect:{destination:"/",permanent:!1}}:{props:{user:s}}}let q=(0,n.M)(r,"default"),E=(0,n.M)(r,"getStaticProps"),b=(0,n.M)(r,"getStaticPaths"),D=(0,n.M)(r,"getServerSideProps"),A=(0,n.M)(r,"config"),N=(0,n.M)(r,"reportWebVitals"),w=(0,n.M)(r,"unstable_getStaticProps"),M=(0,n.M)(r,"unstable_getStaticPaths"),k=(0,n.M)(r,"unstable_getStaticParams"),L=(0,n.M)(r,"unstable_getServerProps"),I=(0,n.M)(r,"unstable_getServerSideProps"),C=new i.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/send-password-reset-link",pathname:"/send-password-reset-link",bundlePath:"",filename:""},components:{App:l.default,Document:o.default},userland:r})},13002:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(8732);function i({message:e,className:t}){return(0,r.jsxs)("div",{className:"info green"+(t?" "+t:""),children:[(0,r.jsx)("img",{src:"/images/checkmark.svg",alt:"Warning Image Icon",width:22,className:"-my-2"}),(0,r.jsx)("span",{children:e})]})}s(82015)},20048:(e,t,s)=>{s(81630);let r=s(67216),i=s(77463),a=s(29021),n=s(6505);async function o(e,t,s,o){let{keyCookieName:l,csrfCookieName:u}=n();if(!e.cookies?.[l]?.match(/./))return null;let c=i({encryptedString:e.cookies[l]});if(!c)return null;let p=JSON.parse(c);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&&!a.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=o},49240:(e,t,s)=>{var r=s(24994);t.A=void 0;var i=r(s(30887)),a=s(8732);t.A=(0,i.default)([(0,a.jsx)("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8m1 13h-2v-6h2zm0-8h-2V7h2z",opacity:".3"},"0"),(0,a.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"},"1")],"InfoTwoTone")},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",i=t;e?.userId&&(i+=`user_${e.userId}_`),e?.database&&(i+=`${e.database}_`),i+=s;let a=t;return e?.userId&&(a+=`user_${e.userId}_`),e?.database&&(a+=`${e.database}_`),{keyCookieName:i,csrfCookieName:a+=r}}},77463:(e,t,s)=>{let{scryptSync:r,createDecipheriv:i}=s(55511),{Buffer:a}=s(79428);e.exports=({encryptedString:e,encryptionKey:t,encryptionSalt:s})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=t||process.env.DSQL_ENCRYPTION_PASSWORD,o=s||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=i("aes-192-cbc",r(n,o,l),a.alloc(16,0));try{let t=u.update(e,"hex","utf8");return t+=u.final("utf8")}catch(t){return console.log("Error in decrypting =>",t.message),e}}},67216:(e,t,s)=>{let r=s(9973),i=s(31976),a=r({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:i()}});async function n(...e){try{let t=await a.query(...e);return await a.end(),JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=n},31976:(e,t,s)=>{let r=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let t=`${e}/ca-cert.pem`;if(!r.existsSync(t)){console.log(`${t} does not exist`);return}return{ca:r.readFileSync(`${e}/ca-cert.pem`)}}},49407:(e,t,s)=>{s.r(t),s.d(t,{default:()=>a});var r=s(8732);s(82015);var i=s(20883);function a(e){return(0,r.jsxs)(i.Html,{lang:"en",children:[(0,r.jsxs)(i.Head,{children:[(0,r.jsx)("meta",{name:"author",content:"Datasquirel"}),(0,r.jsx)("meta",{name:"Copyright",content:`Copyright (c) ${new Date().getFullYear()} Datasquirel`}),"dev_dev".match(/dev/)&&(0,r.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,r.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com/",crossOrigin:"anonymous"}),(0,r.jsx)("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Poppins"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Inter"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=IBM+Plex+Mono"}),(0,r.jsx)("script",{src:"/scripts/themeSelector.js"}),(0,r.jsx)("meta",{httpEquiv:"Content-Type",content:"text/html; charset=UTF-8"}),(0,r.jsx)("meta",{property:"og:site_name",content:"DATASQUIREL"}),(0,r.jsx)("meta",{property:"og:type",content:"website"}),(0,r.jsx)("meta",{name:"twitter:card",content:"summary"}),(0,r.jsx)("meta",{property:"og:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("meta",{itemProp:"image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("meta",{name:"twitter:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("link",{rel:"stylesheet",href:"/styles/prism.css"}),(0,r.jsx)("script",{src:"/scripts/prism.js",async:!0}),(0,r.jsx)("script",{dangerouslySetInnerHTML:{__html:"var DSQL = {}"}})]}),(0,r.jsxs)("body",{children:[(0,r.jsx)(i.Main,{}),(0,r.jsx)(i.NextScript,{})]})]})}},9455:(e,t)=>{var s;Object.defineProperty(t,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},66099:e=>{e.exports=require("@mui/system")},37616:e=>{e.exports=require("@mui/system/DefaultPropsProvider")},24509:e=>{e.exports=require("@mui/system/InitColorSchemeScript")},84781:e=>{e.exports=require("@mui/system/colorManipulator")},18215:e=>{e.exports=require("@mui/system/createStyled")},59989:e=>{e.exports=require("@mui/system/createTheme")},16670:e=>{e.exports=require("@mui/system/styleFunctionSx")},88698:e=>{e.exports=require("@mui/system/useThemeProps")},76831:e=>{e.exports=require("@mui/utils")},28578:e=>{e.exports=require("@mui/utils/capitalize")},14036:e=>{e.exports=require("@mui/utils/composeClasses")},31112:e=>{e.exports=require("@mui/utils/createChainedFunction")},21763:e=>{e.exports=require("@mui/utils/debounce")},7546:e=>{e.exports=require("@mui/utils/deepmerge")},5928:e=>{e.exports=require("@mui/utils/deprecatedPropType")},20985:e=>{e.exports=require("@mui/utils/formatMuiErrorMessage")},61119:e=>{e.exports=require("@mui/utils/generateUtilityClass")},81699:e=>{e.exports=require("@mui/utils/generateUtilityClasses")},29823:e=>{e.exports=require("@mui/utils/isMuiElement")},55402:e=>{e.exports=require("@mui/utils/ownerDocument")},46875:e=>{e.exports=require("@mui/utils/ownerWindow")},48080:e=>{e.exports=require("@mui/utils/requirePropFactory")},39597:e=>{e.exports=require("@mui/utils/setRef")},88190:e=>{e.exports=require("@mui/utils/unsupportedProp")},83889:e=>{e.exports=require("@mui/utils/useControlled")},21956:e=>{e.exports=require("@mui/utils/useEnhancedEffect")},4926:e=>{e.exports=require("@mui/utils/useEventCallback")},7376:e=>{e.exports=require("@mui/utils/useForkRef")},63310:e=>{e.exports=require("@mui/utils/useId")},10977:e=>{e.exports=require("@mui/utils/useIsFocusVisible")},74956:e=>{e.exports=require("clsx")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},29825:e=>{e.exports=require("prop-types")},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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")}};var t=require("../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[9764,883,8268],()=>s(67097));module.exports=r})();