355 lines
14 KiB
JavaScript
355 lines
14 KiB
JavaScript
"use strict";
|
|
(() => {
|
|
var exports = {};
|
|
exports.id = 3851;
|
|
exports.ids = [3851];
|
|
exports.modules = {
|
|
|
|
/***/ 1725:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"SendPassResetContext": () => (/* binding */ SendPassResetContext),
|
|
"default": () => (/* binding */ SendPasswordResetLinkPage),
|
|
"getServerSideProps": () => (/* binding */ getServerSideProps)
|
|
});
|
|
|
|
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
var jsx_runtime_ = __webpack_require__(997);
|
|
// EXTERNAL MODULE: external "react"
|
|
var external_react_ = __webpack_require__(6689);
|
|
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
// EXTERNAL MODULE: ./layouts/GeneralLayout.jsx + 1 modules
|
|
var GeneralLayout = __webpack_require__(6217);
|
|
// EXTERNAL MODULE: ./components/general/PageHeadTags.jsx
|
|
var PageHeadTags = __webpack_require__(4097);
|
|
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
|
|
var LoadingBlock = __webpack_require__(5264);
|
|
// EXTERNAL MODULE: ./functions/backend/userAuth.js
|
|
var userAuth = __webpack_require__(370);
|
|
var userAuth_default = /*#__PURE__*/__webpack_require__.n(userAuth);
|
|
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
|
|
var fetchApi = __webpack_require__(6729);
|
|
// EXTERNAL MODULE: ./components/general/FormSuccessBlock.jsx
|
|
var FormSuccessBlock = __webpack_require__(2186);
|
|
;// CONCATENATED MODULE: external "@mui/icons-material/InfoTwoTone"
|
|
const InfoTwoTone_namespaceObject = require("@mui/icons-material/InfoTwoTone");
|
|
var InfoTwoTone_default = /*#__PURE__*/__webpack_require__.n(InfoTwoTone_namespaceObject);
|
|
;// CONCATENATED MODULE: ./components/general/InfoBlock.jsx
|
|
// @ts-check
|
|
/**
|
|
* ==============================================================================
|
|
* Imports
|
|
* ==============================================================================
|
|
*/
|
|
|
|
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Main Component { Functional }
|
|
* ==============================================================================
|
|
* @param {Object} props - Server props
|
|
* @param {string} props.message
|
|
*/ function InfoBlock({ message }) {
|
|
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
|
className: "info gray",
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx((InfoTwoTone_default()), {
|
|
fontSize: "small",
|
|
color: "inherit",
|
|
className: "opacity-50 text-gray-600"
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
|
className: "font-normal",
|
|
children: message
|
|
})
|
|
]
|
|
});
|
|
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
|
|
|
;// CONCATENATED MODULE: ./pages/send-password-reset-link.jsx
|
|
// @ts-check
|
|
/**
|
|
* ==============================================================================
|
|
* Imports
|
|
* ==============================================================================
|
|
*/
|
|
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** ****************************************************************************** */ /** @type {{ user: import("@/package-shared/types").UserType | null }} */ // @ts-ignore
|
|
const init = {};
|
|
const SendPassResetContext = /*#__PURE__*/ external_react_default().createContext(init);
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Main Component { Functional }
|
|
* ==============================================================================
|
|
* @param {Object} props - Server props
|
|
* @param {import("@/package-shared/types").UserType} props.user
|
|
*/ function SendPasswordResetLinkPage(props) {
|
|
/**
|
|
* Get Contexts
|
|
*
|
|
* @abstract { React.useContext }
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Javascript Variables
|
|
*
|
|
* @abstract Non hook variables and functions
|
|
*/ const pageTitle = "Cloudbased SQL data management system | Datasquirel";
|
|
const pageDescription = "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.";
|
|
let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx("title", {
|
|
children: pageTitle
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("meta", {
|
|
name: "description",
|
|
content: pageDescription
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx(PageHeadTags/* default */.Z, {
|
|
pageTitle: pageTitle,
|
|
pageDescription: pageDescription,
|
|
pagePathname: "/"
|
|
})
|
|
]
|
|
});
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* React Hooks
|
|
*
|
|
* @abstract { useState, useEffect, useRef, etc ... }
|
|
*/ const [loading, setLoading] = external_react_default().useState(false);
|
|
const [emailSent, setEmailSent] = external_react_default().useState(false);
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Function Return
|
|
*
|
|
* @abstract Main Function Return
|
|
*/ return /*#__PURE__*/ jsx_runtime_.jsx(GeneralLayout/* default */.Z, {
|
|
head: head,
|
|
user: props.user,
|
|
children: /*#__PURE__*/ jsx_runtime_.jsx(SendPassResetContext.Provider, {
|
|
value: {
|
|
user: props.user
|
|
},
|
|
children: /*#__PURE__*/ jsx_runtime_.jsx("main", {
|
|
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("section", {
|
|
children: [
|
|
loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}),
|
|
emailSent ? /*#__PURE__*/ jsx_runtime_.jsx(FormSuccessBlock/* default */.Z, {
|
|
message: "Email Sent. Please check your email address and follow the link provided",
|
|
className: "whitespace-nowrap"
|
|
}) : /*#__PURE__*/ jsx_runtime_.jsx("div", {
|
|
className: "paper",
|
|
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
|
className: "max-w-xl flex-col items-stretch",
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx("h1", {
|
|
className: "m-0 text-4xl",
|
|
children: "Send Password Reset Link"
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
|
children: "Please enter your email address to receive a password reset link"
|
|
}),
|
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("form", {
|
|
className: "w-full flex flex-col items-stretch gap-4",
|
|
onSubmit: (e)=>{
|
|
setLoading(true);
|
|
e.preventDefault();
|
|
/** @type {HTMLFormElement} */ // @ts-ignore
|
|
const formEl = e.target;
|
|
const email = formEl["email-address"].value;
|
|
(0,fetchApi/* default */.Z)(`/api/sendPasswordResetLink?email=${email}`).then((res)=>{
|
|
console.log(res);
|
|
setTimeout(()=>{
|
|
setLoading(false);
|
|
}, 500);
|
|
if (res.success) {
|
|
setEmailSent(true);
|
|
}
|
|
});
|
|
},
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx("input", {
|
|
type: "text",
|
|
autoComplete: "email",
|
|
name: "email-address",
|
|
id: "email-address",
|
|
className: "w-full",
|
|
placeholder: "Email Address",
|
|
defaultValue: props?.user?.logged_in_status ? props.user.email : "",
|
|
required: true
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("button", {
|
|
children: "Send password reset Email"
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx(InfoBlock, {
|
|
message: "Please note that this link will expire after 1 hour"
|
|
})
|
|
]
|
|
})
|
|
]
|
|
})
|
|
})
|
|
]
|
|
})
|
|
})
|
|
})
|
|
});
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
}
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Server Side Props or Static Props
|
|
* ==============================================================================
|
|
* @type {import("next").GetServerSideProps}
|
|
*/ async function getServerSideProps({ req , res }) {
|
|
/**
|
|
* User Auth
|
|
*
|
|
* @description User Auth
|
|
*/ const user = await userAuth_default()(req, res);
|
|
if (user?.social_login) {
|
|
return {
|
|
redirect: {
|
|
destination: "/",
|
|
permanent: false
|
|
}
|
|
};
|
|
}
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Server props return
|
|
*
|
|
* @description Return data fetched on the server side
|
|
*/ return {
|
|
props: {
|
|
user: user
|
|
}
|
|
};
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 386:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/CottageTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5557:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2423:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("lucide-react");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 968:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("next/head");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6689:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("react");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 997:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("react/jsx-runtime");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 2261:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("serverless-mysql");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4300:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("buffer");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6113:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("crypto");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 7147:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("fs");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3685:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("http");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1017:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("path");
|
|
|
|
/***/ })
|
|
|
|
};
|
|
;
|
|
|
|
// load runtime
|
|
var __webpack_require__ = require("../webpack-runtime.js");
|
|
__webpack_require__.C(exports);
|
|
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
|
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,9360,6217,4097,2186], () => (__webpack_exec__(1725)));
|
|
module.exports = __webpack_exports__;
|
|
|
|
})(); |