Commit a26e7d3e authored by Mathias Engelbrecht Pilegård's avatar Mathias Engelbrecht Pilegård
Browse files

fixed forgot password modal popup flow

parent 5690006f
This diff is collapsed.
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState);\n\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = e => {\n e.preventDefault();\n toggleForgotPasswordFormVisible();\n setSubmitOkMessageModalState(true); // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // window.alert(\"Error: something went wrong\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // toggleSubmitOkModalVisible()\n // }\n // })\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(MessageModal, {\n removeModal: () => setSubmitOkMessageModalState(false),\n headerMessage: \"Email submitted!\",\n bodyMessage: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"g4WkMIawwrBahYMYonVecg/0JA0=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","forgotPasswordFormVisibilityState","setForgotPasswordFormVisibilityState","forgotPasswordFormRef","toggleForgotPasswordFormVisible","submitOkMessageModalState","setSubmitOkMessageModalState","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","preventDefault"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC,QAAM,CAACC,iCAAD,EAAoCC,oCAApC,IAA4ER,QAAQ,CAAC,KAAD,CAA1F;AACA,QAAMS,qBAAqB,GAAGR,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMS,+BAA+B,GAAG,MAAMF,oCAAoC,CAAC,CAACD,iCAAF,CAAlF;;AAEA,QAAM,CAACI,yBAAD,EAA4BC,4BAA5B,IAA4DZ,QAAQ,CAAC,KAAD,CAA1E;AAEA,QAAM,CAACa,QAAD,EAAWC,WAAX,IAA0Bd,QAAQ,CAAC,EAAD,CAAxC;;AACA,QAAMe,oBAAoB,GAAIC,CAAD,IAAO;AAClCF,IAAAA,WAAW,CAACE,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIAhB,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMiB,cAAc,GAAIH,CAAD,IAAO;AAC5B,UAAIP,qBAAqB,CAACW,OAAtB,KAAkC,IAAlC,IAA0C,CAACX,qBAAqB,CAACW,OAAtB,CAA8BC,QAA9B,CAAuCL,CAAC,CAACC,MAAzC,CAA/C,EAAiG;AAC/FP,QAAAA,+BAA+B;AAChC;AACF,KAJD,CADc,CAOd;;;AACA,QAAIH,iCAAJ,EAAuC;AACrCe,MAAAA,MAAM,CAACC,gBAAP,CAAwB,OAAxB,E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,QAAQ,EAAEE;AAHZ;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAQE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBARF,eAWE;AAAQ,cAAA,SAAS,EAAC,kBAAlB;AAAqC,cAAA,IAAI,EAAC,QAA1C;AAAA,wDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,eA+BE;AAAK,MAAA,SAAS,EAAG,SAAQR,iCAAiC,GAAG,QAAH,GAAc,UAAW,EAAnF;AAAA,6BACE,QAAC,YAAD;AAAc,QAAA,WAAW,EAAE,MAAMK,4BAA4B,CAAC,KAAD,CAA7D;AAAsE,QAAA,aAAa,EAAE,kBAArF;AAAyG,QAAA,WAAW,EAAE;AAAtH;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YA/BF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAsCD,CA/FD;;GAAMN,mB;;KAAAA,mB;AAiGN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState)\r\n\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const [username, setUsername] = useState('');\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n\r\n toggleForgotPasswordFormVisible()\r\n setSubmitOkMessageModalState(true)\r\n // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // window.alert(\"Error: something went wrong\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // toggleSubmitOkModalVisible()\r\n // }\r\n // })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <MessageModal removeModal={() => setSubmitOkMessageModalState(false)} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n // Submit ok modal\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false);\n const submitOkModalRef = useRef(null);\n\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState); // Forgot password form\n\n\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => {\n showForgotPasswordForm(!forgotPasswordFormVisibilityState);\n };\n\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n useEffect(() => {\n const pageClickEvent = e => {\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\n toggleSubmitOkModalVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (submitOkModalVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [submitOkModalVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = () => {\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n toggleSubmitOkModalVisible();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 7\n }, this), submitOkModalVisibilityState && /*#__PURE__*/_jsxDEV(MessageModal, {\n ref: submitOkModalRef,\n headerMessage: \"Email submitted!\",\n bodyMessage: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"JewdldMzKvoWUXPBjhAQ4J+HRI8=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","submitOkModalVisibilityState","showSubmitOkModal","submitOkModalRef","toggleSubmitOkModalVisible","forgotPasswordFormVisibilityState","showForgotPasswordForm","forgotPasswordFormRef","toggleForgotPasswordFormVisible","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","fetch","serviceAPI","ForgotPasswordURL","then","res","ok","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC;AACA,QAAM,CAACC,4BAAD,EAA+BC,iBAA/B,IAAoDR,QAAQ,CAAC,KAAD,CAAlE;AACA,QAAMS,gBAAgB,GAAGR,MAAM,CAAC,IAAD,CAA/B;;AACA,QAAMS,0BAA0B,GAAG,MAAMF,iBAAiB,CAAC,CAACD,4BAAF,CAA1D,CAJgC,CAMhC;;;AACA,QAAM,CAACI,iCAAD,EAAoCC,sBAApC,IAA8DZ,QAAQ,CAAC,KAAD,CAA5E;AACA,QAAMa,qBAAqB,GAAGZ,MAAM,CA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C,OADL;AACa,gBAAA,IAAI,EAAC,MADlB;AAEE,gBAAA,KAAK,EAAEnB,QAFT;AAGE,gBAAA,QAAQ,EAAEE;AAHZ;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAQE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBARF,eAWE;AAAQ,cAAA,SAAS,EAAC,kBAAlB;AAAqC,cAAA,IAAI,EAAC,QAA1C;AAAA,wDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,EA+BGV,4BAA4B,iBAC3B,QAAC,YAAD;AAAc,MAAA,GAAG,EAAEE,gBAAnB;AAAqC,MAAA,aAAa,EAAE,kBAApD;AAAwE,MAAA,WAAW,EAAE;AAArF;AAAA;AAAA;AAAA;AAAA,YAhCJ;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAsCD,CApHD;;GAAMH,mB;;KAAAA,mB;AAsHN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n // Submit ok modal\r\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false)\r\n const submitOkModalRef = useRef(null)\r\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState)\r\n\r\n // Forgot password form\r\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => {\r\n showForgotPasswordForm(!forgotPasswordFormVisibilityState)\r\n }\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (submitOkModalVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [submitOkModalVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = () => {\r\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n {submitOkModalVisibilityState && (\r\n <MessageModal ref={submitOkModalRef} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n )}\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n // Submit ok modal\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false);\n const submitOkModalRef = useRef(null);\n\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState); // Forgot password form\n\n\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => {\n showForgotPasswordForm(!forgotPasswordFormVisibilityState);\n };\n\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n useEffect(() => {\n const pageClickEvent = e => {\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\n toggleSubmitOkModalVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (submitOkModalVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [submitOkModalVisibilityState]);\n const userInputData = JSON.stringify({\n firstname: '',\n lastname: '',\n email: `${username}`,\n password: ''\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = () => {\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n toggleSubmitOkModalVisible();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 103,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${submitOkModalVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: submitOkModalRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"submitOkModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Email submitted!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 124,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 125,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: \"Ok\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 128,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 123,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 121,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"JewdldMzKvoWUXPBjhAQ4J+HRI8=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","PasswordForgotModal","submitOkModalVisibilityState","showSubmitOkModal","submitOkModalRef","toggleSubmitOkModalVisible","forgotPasswordFormVisibilityState","showForgotPasswordForm","forgotPasswordFormRef","toggleForgotPasswordFormVisible","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","firstname","lastname","email","password","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","fetch","serviceAPI","ForgotPasswordURL","then","res","ok","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC;AACA,QAAM,CAACC,4BAAD,EAA+BC,iBAA/B,IAAoDP,QAAQ,CAAC,KAAD,CAAlE;AACA,QAAMQ,gBAAgB,GAAGP,MAAM,CAAC,IAAD,CAA/B;;AACA,QAAMQ,0BAA0B,GAAG,MAAMF,iBAAiB,CAAC,CAACD,4BAAF,CAA1D,CAJgC,CAMhC;;;AACA,QAAM,CAACI,iCAAD,EAAoCC,sBAApC,IAA8DX,QAAQ,CAAC,KAAD,CAA5E;AACA,QAAMY,qBAAqB,GAAGX,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMY,+BAA+B,GAAG,MAAM;AAC5CF,IAAAA,sBAAsB,CAAC,CAACD,iCAAF,CAAtB;AACD,GAFD;;AAIA,QAAM,CAACI,QAAD,EAAWC,WAAX,IAA0Bf,QAAQ,CAAC,EAAD,CAAxC;;AAEA,QAAMgB,oBAAoB,GAAIC,CAAD,IAAO;AAClCF,IAAAA,WAAW,CAACE,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIAjB,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMkB,cAAc,GAAIH,CAAD,IAAO;AAC5B,UAAIL,qBAAqB,CAACS,OAAtB,KAAkC,IAAlC,IAA0C,CAACT,qBAAqB,CAACS,OAAtB,CAA8BC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A;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,eAiCE;AAAK,MAAA,SAAS,EAAG,SAAQV,4BAA4B,GAAG,QAAH,GAAc,UAAW,EAA9E;AAAA,6BACE;AAAK,QAAA,GAAG,EAAEE,gBAAV;AAA4B,QAAA,SAAS,EAAC,eAAtC;AAAA,+BACE;AAAK,UAAA,SAAS,EAAC,eAAf;AAAA,kCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF,eAKE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAjCF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAkDD,CAnID;;GAAMH,mB;;KAAAA,mB;AAqIN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\n\r\nconst PasswordForgotModal = () => {\r\n // Submit ok modal\r\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false)\r\n const submitOkModalRef = useRef(null)\r\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState)\r\n\r\n // Forgot password form\r\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => {\r\n showForgotPasswordForm(!forgotPasswordFormVisibilityState)\r\n }\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (submitOkModalVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [submitOkModalVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: '',\r\n lastname: '',\r\n email: `${username}`,\r\n password: ''\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = () => {\r\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n {/* SubmitOk modal */}\r\n <div className={`modal ${submitOkModalVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={submitOkModalRef} className=\"modal-content\">\r\n <div className=\"submitOkModal\">\r\n <h2>Email submitted!</h2>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Ok\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState);\n\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = e => {\n e.preventDefault();\n toggleForgotPasswordFormVisible();\n setSubmitOkMessageModalState(true); // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // window.alert(\"Error: something went wrong\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // toggleSubmitOkModalVisible()\n // }\n // })\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(MessageModal, {\n removeModal: () => setSubmitOkMessageModalState(false),\n headerMessage: \"Email submitted!\",\n bodyMessage: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"g4WkMIawwrBahYMYonVecg/0JA0=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","forgotPasswordFormVisibilityState","setForgotPasswordFormVisibilityState","forgotPasswordFormRef","toggleForgotPasswordFormVisible","submitOkMessageModalState","setSubmitOkMessageModalState","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","preventDefault"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC,QAAM,CAACC,iCAAD,EAAoCC,oCAApC,IAA4ER,QAAQ,CAAC,KAAD,CAA1F;AACA,QAAMS,qBAAqB,GAAGR,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMS,+BAA+B,GAAG,MAA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AAA,WAAW,EAAE,MAAMC,4BAA4B,CAAC,KAAD,CAA7D;AAAsE,QAAA,aAAa,EAAE,kBAArF;AAAyG,QAAA,WAAW,EAAE;AAAtH;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YA/BF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAsCD,CA/FD;;GAAMN,mB;;KAAAA,mB;AAiGN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState)\r\n\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const [username, setUsername] = useState('');\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n\r\n toggleForgotPasswordFormVisible()\r\n setSubmitOkMessageModalState(true)\r\n // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // window.alert(\"Error: something went wrong\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // toggleSubmitOkModalVisible()\r\n // }\r\n // })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div className={`modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`}>\r\n <MessageModal removeModal={() => setSubmitOkMessageModalState(false)} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = ({\n removeFormModal\n}) => {\n _s();\n\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = e => {\n e.preventDefault();\n removeFormModal();\n setSubmitOkMessageModalState(true); // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // window.alert(\"Error: something went wrong\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // toggleSubmitOkModalVisible()\n // }\n // })\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-background\",\n onClick: e => removeFormModal(),\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 50,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 49,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 48,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 47,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"ccs9TXv4Z39DCQsrqL8dXg2nBZI=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","removeFormModal","submitOkMessageModalState","setSubmitOkMessageModalState","stopProp","e","stopPropagation","username","setUsername","handleUsernameChange","target","value","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","preventDefault"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAyB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AAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAQE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,sDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAyBD,CAhED;;GAAMT,mB;;KAAAA,mB;AAkEN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = ({ removeFormModal }) => {\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n const [username, setUsername] = useState('');\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n\r\n removeFormModal()\r\n setSubmitOkMessageModalState(true)\r\n // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // window.alert(\"Error: something went wrong\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // toggleSubmitOkModalVisible()\r\n // }\r\n // })\r\n }\r\n\r\n return (\r\n <div className=\"modal-background\" onClick={e => removeFormModal()}>\r\n <div className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n {/* <div className={`modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`}>\r\n <MessageModal removeModal={() => setSubmitOkMessageModalState(false)} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n </div> */}\r\n </div>\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport config from '../../config';\nimport SignUp from './signUp/SignUp';\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 62,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(PasswordForgotModal, {\n loginFormUsername: parseFloat(username)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"u8yY6NlW4PSOG6xgLhGhaVL5lVE=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","config","SignUp","PasswordForgotModal","Login","authState","oktaAuth","sessionToken","setSessionToken","username","setUsername","password","setPassword","handleUsernameChange","e","target","value","handlePasswordChange","userInputData","JSON","stringify","email","loginRequestOptions","method","body","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","console","log","isAuthenticated","parseFloat"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,M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AAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE,QAAC,mBAAD;AAAqB,UAAA,iBAAiB,EAAEoB,UAAU,CAAC5B,QAAD;AAAlD;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAHF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA8BD,GA/BD,MA+BO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CA7ED;;GAAML,K;UAC4BP,W;;;KAD5BO,K;AA+EN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\nimport config from '../../config';\r\nimport SignUp from './signUp/SignUp';\r\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <PasswordForgotModal loginFormUsername={parseFloat(username)} />\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState);\n\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = e => {\n e.preventDefault();\n window.alert(userInputData);\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n toggleForgotPasswordFormVisible();\n setSubmitOkMessageModalState(true);\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 69,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(MessageModal, {\n removeModal: () => setSubmitOkMessageModalState(false),\n headerMessage: \"Email submitted!\",\n bodyMessage: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"g4WkMIawwrBahYMYonVecg/0JA0=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","forgotPasswordFormVisibilityState","setForgotPasswordFormVisibilityState","forgotPasswordFormRef","toggleForgotPasswordFormVisible","submitOkMessageModalState","setSubmitOkMessageModalState","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","preventDefault","alert","fetch","serviceAPI","ForgotPasswordURL","then","res","ok","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC,QAAM,CAACC,iCAAD,EAAoCC,oCAApC,I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BAAlB;AAAqC,cAAA,IAAI,EAAC,QAA1C;AAAA,wDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,eA+BE;AAAK,MAAA,SAAS,EAAG,SAAQJ,yBAAyB,GAAG,QAAH,GAAc,UAAW,EAA3E;AAAA,6BACE,QAAC,YAAD;AAAc,QAAA,WAAW,EAAE,MAAMC,4BAA4B,CAAC,KAAD,CAA7D;AAAsE,QAAA,aAAa,EAAE,kBAArF;AAAyG,QAAA,WAAW,EAAE;AAAtH;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YA/BF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAsCD,CAhGD;;GAAMN,mB;;KAAAA,mB;AAkGN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState)\r\n\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n window.alert(userInputData)\r\n\r\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n toggleForgotPasswordFormVisible()\r\n setSubmitOkMessageModalState(true)\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div className={`modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`}>\r\n <MessageModal removeModal={() => setSubmitOkMessageModalState(false)} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n // Submit ok modal\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false);\n const submitOkModalRef = useRef(null);\n\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState); // Forgot password form\n\n\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => {\n showForgotPasswordForm(!forgotPasswordFormVisibilityState);\n };\n\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n useEffect(() => {\n const pageClickEvent = e => {\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\n toggleSubmitOkModalVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (submitOkModalVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [submitOkModalVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = () => {\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n toggleSubmitOkModalVisible();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(MessageModal, {\n ref: submitOkModalRef,\n headerMessage: \"Email submitted!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 117,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"JewdldMzKvoWUXPBjhAQ4J+HRI8=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","submitOkModalVisibilityState","showSubmitOkModal","submitOkModalRef","toggleSubmitOkModalVisible","forgotPasswordFormVisibilityState","showForgotPasswordForm","forgotPasswordFormRef","toggleForgotPasswordFormVisible","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","fetch","serviceAPI","ForgotPasswordURL","then","res","ok","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC;AACA,QAAM,CAACC,4BAAD,EAA+BC,iBAA/B,IAAoDR,QAAQ,CAAC,KAAD,CAAlE;AACA,QAAMS,gBAAgB,GAAGR,MAAM,CAAC,IAAD,CAA/B;;AACA,QAAMS,0BAA0B,GAAG,MAAMF,iBAAiB,CAAC,CAACD,4BAAF,CAA1D,CAJgC,CAMhC;;;AACA,QAAM,CAACI,iCAAD,EAAoCC,sBAApC,IAA8DZ,QAAQ,CAAC,KAAD,CAA5E;AACA,QAAMa,qBAAqB,GAAGZ,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMa,+BAA+B,GAAG,MAAM;AAC5CF,IAAAA,sBAAsB,CAAC,CAACD,iCAAF,CAAtB;AACD,GAFD;;AAIA,QAAM,CAACI,QAAD,EAAWC,WAAX,IAA0BhB,QAAQ,CAAC,EAAD,CAAxC;;AAEA,QAAMiB,oBAAoB,GAAIC,CAAD,IAAO;AAClCF,IAAAA,WAA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EAAC,kBAAlB;AAAqC,cAAA,IAAI,EAAC,QAA1C;AAAA,wDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,eA+BE,QAAC,YAAD;AAAc,MAAA,GAAG,EAAER,gBAAnB;AAAqC,MAAA,aAAa,EAAE;AAApD;AAAA;AAAA;AAAA;AAAA,YA/BF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAoCD,CAlHD;;GAAMH,mB;;KAAAA,mB;AAoHN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n // Submit ok modal\r\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false)\r\n const submitOkModalRef = useRef(null)\r\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState)\r\n\r\n // Forgot password form\r\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => {\r\n showForgotPasswordForm(!forgotPasswordFormVisibilityState)\r\n }\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (submitOkModalVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [submitOkModalVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = () => {\r\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <MessageModal ref={submitOkModalRef} headerMessage={\"Email submitted!\"} />\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState);\n\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = e => {\n e.preventDefault();\n toggleForgotPasswordFormVisible(); // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // window.alert(\"Error: something went wrong\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // toggleSubmitOkModalVisible()\n // }\n // })\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(MessageModal, {\n activeState: \"false\",\n headerMessage: \"Email submitted!\",\n bodyMessage: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"g4WkMIawwrBahYMYonVecg/0JA0=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","forgotPasswordFormVisibilityState","setForgotPasswordFormVisibilityState","forgotPasswordFormRef","toggleForgotPasswordFormVisible","submitOkMessageModalState","setSubmitOkMessageModalState","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","preventDefault"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC,QAAM,CAACC,iCAAD,EAAoCC,oCAApC,IAA4ER,QAAQ,CAAC,KAAD,CAA1F;AACA,QAAMS,qBAAqB,GAAGR,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMS,+BAA+B,GAAG,MAAMF,oCAAoC,CAAC,CAACD,iCAAF,CAAlF;;AAEA,QAAM,CAACI,yBAAD,EAA4BC,4BAA5B,IAA4DZ,QAAQ,CAAC,KAAD,CAA1E;AAEA,QAAM,CAACa,QAAD,EAAWC,WAAX,IAA0Bd,QAAQ,CAAC,EAAD,CAAxC;;AACA,QAAMe,oBAAoB,GAAIC,CAAD,IAAO;AAClCF,IAAAA,WAAW,CAACE,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIAhB,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMiB,cAAc,GAAIH,CAAD,IAAO;AAC5B,UAAIP,qBAAqB,CAACW,OAAtB,KAAkC,IAAlC,IAA0C,CAACX,qBAAqB,CAACW,OAAtB,CAA8BC,QAA9B,CAAuCL,CAAC,CAACC,MAAzC,CAA/C,EAAiG;AAC/FP,QAAAA,+BAA+B;AAChC;AACF,KAJD,CADc,CAOd;;;AACA,QAAIH,iCAAJ,EAAuC;AACrCe,MAAAA,MAAM,CAACC,gBAAP,CAAwB,OAAxB,EAAiCJ,cAAjC;AACD;;AAED,WAAO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;AAAA,oBADF,eAQE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBARF,eAWE;AAAQ,cAAA,SAAS,EAAC,kBAAlB;AAAqC,cAAA,IAAI,EAAC,QAA1C;AAAA,wDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,eA+BE,QAAC,YAAD;AAAc,MAAA,WAAW,EAAE,OAA3B;AAAoC,MAAA,aAAa,EAAE,kBAAnD;AAAuE,MAAA,WAAW,EAAE;AAApF;AAAA;AAAA;AAAA;AAAA,YA/BF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAoCD,CA5FD;;GAAMT,mB;;KAAAA,mB;AA8FN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState)\r\n\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const [username, setUsername] = useState('');\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n\r\n toggleForgotPasswordFormVisible()\r\n // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // window.alert(\"Error: something went wrong\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // toggleSubmitOkModalVisible()\r\n // }\r\n // })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <MessageModal activeState={\"false\"} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n // Submit ok modal\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false);\n const submitOkModalRef = useRef(null);\n\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState); // Forgot password form\n\n\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => {\n showForgotPasswordForm(!forgotPasswordFormVisibilityState);\n };\n\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n useEffect(() => {\n const pageClickEvent = e => {\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\n toggleSubmitOkModalVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (submitOkModalVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [submitOkModalVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = e => {\n e.preventDefault();\n toggleForgotPasswordFormVisible();\n toggleSubmitOkModalVisible(); // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // window.alert(\"Error: something went wrong\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // toggleSubmitOkModalVisible()\n // }\n // })\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 103,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 7\n }, this), submitOkModalVisibilityState && /*#__PURE__*/_jsxDEV(MessageModal, {\n ref: submitOkModalRef,\n headerMessage: \"Email submitted!\",\n bodyMessage: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"JewdldMzKvoWUXPBjhAQ4J+HRI8=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","submitOkModalVisibilityState","showSubmitOkModal","submitOkModalRef","toggleSubmitOkModalVisible","forgotPasswordFormVisibilityState","showForgotPasswordForm","forgotPasswordFormRef","toggleForgotPasswordFormVisible","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","preventDefault"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC;AACA,QAAM,CAACC,4BAAD,EAA+BC,iBAA/B,IAAoDR,QAAQ,CAAC,KAAD,CAAlE;AACA,QAAMS,gBAAgB,GAAGR,MAAM,CAAC,IAAD,CAA/B;;AACA,QAAMS,0BAA0B,GAAG,MAAMF,iBAAiB,CAAC,CAACD,4BAAF,CAA1D,CAJgC,CAMhC;;;AACA,QAAM,CAACI,iCAAD,EAAoCC,sBAApC,IAA8DZ,QAAQ,CAAC,KAAD,CAA5E;AACA,QAAMa,qBAAqB,GAAGZ,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMa,+BAA+B,GAAG,MAAM;AAC5CF,IAAAA,sBAAsB,CAAC,CAACD,iCAAF,CAAtB;AACD,GAFD;;AAIA,QAAM,CAACI,QAAD,EAAWC,WAAX,IAA0BhB,QAAQ,CAAC,EAAD,CAAxC;;AAEA,QAAMiB,oBAAoB,GAAIC,CAAD,IAAO;AAClCF,IAAAA,WAAW,CAACE,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIAlB,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMmB,cAAc,GAAIH,CAAD,IAAO;AAC5B,UAAIL,qBAAqB,CAACS,OAAtB,KAAkC,IA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ApD;AAAwE,MAAA,WAAW,EAAE;AAArF;AAAA;AAAA;AAAA;AAAA,YAhCJ;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAsCD,CAxHD;;GAAMH,mB;;KAAAA,mB;AA0HN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n // Submit ok modal\r\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false)\r\n const submitOkModalRef = useRef(null)\r\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState)\r\n\r\n // Forgot password form\r\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => {\r\n showForgotPasswordForm(!forgotPasswordFormVisibilityState)\r\n }\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (submitOkModalVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [submitOkModalVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n\r\n toggleForgotPasswordFormVisible()\r\n toggleSubmitOkModalVisible()\r\n // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // window.alert(\"Error: something went wrong\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // toggleSubmitOkModalVisible()\r\n // }\r\n // })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n {/* <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label> */}\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n {submitOkModalVisibilityState && (\r\n <MessageModal ref={submitOkModalRef} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n )}\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport config from '../../config';\nimport SignUp from './signUp/SignUp';\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 62,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(PasswordForgotModal, {\n loginFormUsername: parsefloat(username)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"u8yY6NlW4PSOG6xgLhGhaVL5lVE=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","config","SignUp","PasswordForgotModal","Login","authState","oktaAuth","sessionToken","setSessionToken","username","setUsername","password","setPassword","handleUsernameChange","e","target","value","handlePasswordChange","userInputData","JSON","stringify","email","loginRequestOptions","method","body","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","console","log","isAuthenticated","parsefloat"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,mBAAP,MAAgC,qCAAhC;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BT,WAAW,EAA3C;AACA,QAAM,CAACU,YAAD,EAAeC,eAAf,IAAkCf,QAAQ,EAAhD;AAEA,QAAM,CAACgB,QAAD,EAAWC,W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KAD5BO,K;AA+EN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\nimport config from '../../config';\r\nimport SignUp from './signUp/SignUp';\r\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <PasswordForgotModal loginFormUsername={parsefloat(username)} />\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n const [username, setUsername] = useState('');\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => showForgotPasswordForm(!forgotPasswordFormVisibilityState);\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: JSON.stringify({\n email: `${username}`\n })\n };\n\n const handlePasswordForgot = () => {\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if registered within our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign Up\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 56,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"VvmgU4VTr5ZNKM/8uo86UTvcRWY=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","PasswordForgotModal","username","setUsername","forgotPasswordFormVisibilityState","showForgotPasswordForm","forgotPasswordFormRef","toggleForgotPasswordFormVisible","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","ForgotPasswordRequestOptions","method","body","JSON","stringify","email","handlePasswordForgot","fetch","serviceAPI","ForgotPasswordURL","then","res","ok","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAn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;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAPF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAkCD,CAnFD;;GAAMP,mB;;KAAAA,mB;AAqFN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\n\r\nconst PasswordForgotModal = () => {\r\n const [username, setUsername] = useState('');\r\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false)\r\n const forgotPasswordFormRef = useRef(null);\r\n const toggleForgotPasswordFormVisible = () => showForgotPasswordForm(!forgotPasswordFormVisibilityState)\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: JSON.stringify({\r\n email: `${username}`\r\n })\r\n }\r\n\r\n const handlePasswordForgot = () => {\r\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if registered within our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport config from '../../config';\nimport SignUp from './signUp/SignUp';\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false);\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: setForgotPasswordFormVisibilityState(true),\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(PasswordForgotModal, {\n removeModal: () => setForgotPasswordFormVisibilityState(false)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 62,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"XlNc2CmG/vFxCt8acIKy6LZQ9RM=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","config","SignUp","PasswordForgotModal","Login","authState","oktaAuth","sessionToken","setSessionToken","forgotPasswordFormVisibilityState","setForgotPasswordFormVisibilityState","username","setUsername","password","setPassword","handleUsernameChange","e","target","value","handlePasswordChange","userInputData","JSON","stringify","email","loginRequestOptions","method","body","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","console","log","isAuthenticated"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,mBAAP,MAAgC,qCAAhC;;;AAEA,MAAMC,KAAK,GAAG,MAAM;AAAA;;AAClB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BT,WAAW,EAA3C;AACA,QAAM,CAACU,YAAD,EAAeC,eAAf,IAAkCf,QAAQ,EAAhD;AAEA,QAAM,CAACgB,iCAAD,EAAoCC,oCAApC,IAA4EjB,QAAQ,CAAC,KAAD,CAA1F;AAEA,QAAM,CAACkB,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,mBAAD;AAAqB,YAAA,WAAW,EAAE,MAAMC,oCAAoC,CAAC,KAAD;AAA5E;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBA3BF;AAAA;AAAA;AAAA;AAAA;AAAA,cAHF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AAqCD,GAtCD,MAsCO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CAtFD;;GAAMN,K;UAC4BP,W;;;KAD5BO,K;AAwFN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\nimport config from '../../config';\r\nimport SignUp from './signUp/SignUp';\r\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false)\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={setForgotPasswordFormVisibilityState(true)}>Forgot password</a>\r\n </span>\r\n </div>\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <PasswordForgotModal removeModal={() => setForgotPasswordFormVisibilityState(false)} />\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = props => {\n _s();\n\n // Submit ok modal\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false);\n const submitOkModalRef = useRef(null);\n\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState); // Forgot password form\n\n\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => showForgotPasswordForm(!forgotPasswordFormVisibilityState);\n\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n setUsername(props.loginFormUsername);\n }, []);\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n useEffect(() => {\n const pageClickEvent = e => {\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\n toggleSubmitOkModalVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (submitOkModalVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [submitOkModalVisibilityState]);\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: JSON.stringify({\n email: `${username}`\n })\n };\n\n const handlePasswordForgot = () => {\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// do something\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${submitOkModalVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: submitOkModalRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"submitOkModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Email has been submitted!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: \"Ok\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 123,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 121,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 119,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"6nRVeLyPRLhEC+nG9QEudfxhhrM=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","PasswordForgotModal","props","submitOkModalVisibilityState","showSubmitOkModal","submitOkModalRef","toggleSubmitOkModalVisible","forgotPasswordFormVisibilityState","showForgotPasswordForm","forgotPasswordFormRef","toggleForgotPasswordFormVisible","username","setUsername","handleUsernameChange","e","target","value","loginFormUsername","pageClickEvent","current","contains","window","addEventListener","removeEventListener","ForgotPasswordRequestOptions","method","body","JSON","stringify","email","handlePasswordForgot","fetch","serviceAPI","ForgotPasswordURL","then","res","ok","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;;;AAEA,MAAMC,mBAAmB,GAAIC,KAAD,IAAW;AAAA;;AACrC;AACA,QAAM,CAACC,4BAAD,EAA+BC,iBAA/B,IAAoDR,QAAQ,CAAC,KAAD,CAAlE;AACA,QAAMS,gBAAgB,GAAGR,MAAM,CAAC,IAAD,CAA/B;;AACA,QAAMS,0BAA0B,GAAG,MAAMF,iBAAiB,CAAC,CAACD,4BAAF,CAA1D,CAJqC,CAMrC;;;AACA,QAAM,CAACI,iCAAD,EAAoCC,sBAApC,IAA8DZ,QAAQ,CAAC,KAAD,CAA5E;AACA,QAAMa,qBAAqB,GAAGZ,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMa,+BAA+B,GAAG,MAAMF,sBAAsB,CAAC,CAACD,iCAAF,CAApE;;AAGA,QAAM,CAACI,QAAD,EAAWC,WAAX,IAA0BhB,QAAQ,CAAC,EAAD,CAAxC;;AAEA,QAAMiB,oBAAoB,GAAIC,CAAD,IAAO;AAClCF,IAAAA,WAAW,CAACE,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIAlB,EAAAA,SAAS,CAAC,MAAM;AACdc,IA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C,QAA1C;AAAA,wDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,eAiCE;AAAK,MAAA,SAAS,EAAG,SAAQV,4BAA4B,GAAG,QAAH,GAAc,UAAW,EAA9E;AAAA,6BACE;AAAK,QAAA,GAAG,EAAEE,gBAAV;AAA4B,QAAA,SAAS,EAAC,eAAtC;AAAA,+BACE;AAAK,UAAA,SAAS,EAAC,eAAf;AAAA,kCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAEE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAjCF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AA+CD,CA9HD;;GAAMJ,mB;;KAAAA,mB;AAgIN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\n\r\nconst PasswordForgotModal = (props) => {\r\n // Submit ok modal\r\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false)\r\n const submitOkModalRef = useRef(null)\r\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState)\r\n\r\n // Forgot password form\r\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => showForgotPasswordForm(!forgotPasswordFormVisibilityState)\r\n\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n setUsername(props.loginFormUsername)\r\n }, [])\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (submitOkModalVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [submitOkModalVisibilityState]);\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: JSON.stringify({\r\n email: `${username}`\r\n })\r\n }\r\n\r\n const handlePasswordForgot = () => {\r\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // do something\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n {/* SubmitOk modal */}\r\n <div className={`modal ${submitOkModalVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={submitOkModalRef} className=\"modal-content\">\r\n <div className=\"submitOkModal\">\r\n <h2>Email has been submitted!</h2>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Ok\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\messageModal\\\\MessageModal.jsx\";\nimport React, { useState, useEffect, useRef } from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst MessageModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n const stopProp = e => {\n e.stopPropagation();\n }; // useEffect(() => {\n // const pageClickEvent = (e) => {\n // if (messageModalRef.current !== null && !messageModalRef.current.contains(e.target)) {\n // toggleModalVisible()\n // }\n // };\n // // If the item is active (ie open) then listen for clicks\n // if (modalVisibilityState) {\n // window.addEventListener('click', pageClickEvent);\n // }\n // return () => {\n // window.removeEventListener('click', pageClickEvent);\n // }\n // }, [modalVisibilityState]);\n\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal background\",\n onClick: e => removeModal(),\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"submitOkModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: headerMessage\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 30,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: bodyMessage\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 31,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n onClick: e => removeModal(),\n children: \"Ok\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 34,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 5\n }, this);\n};\n\n_c = MessageModal;\nexport default MessageModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"MessageModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/messageModal/MessageModal.jsx"],"names":["React","useState","useEffect","useRef","MessageModal","removeModal","headerMessage","bodyMessage","stopProp","e","stopPropagation"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;;;AAEA,MAAMC,YAAY,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AACpE,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD,CADoE,CAKpE;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;;;AAEA,sBACE;AAAK,IAAA,SAAS,EAAC,kBAAf;AAAkC,IAAA,OAAO,EAAED,CAAC,IAAIJ,WAAW,EAA3D;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,eAAf;AAAA,6BACE;AAAK,QAAA,SAAS,EAAC,eAAf;AAAA,gCACE;AAAA,oBAAKC;AAAL;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE;AAAA,oBACGC;AADH;AAAA;AAAA;AAAA;AAAA,gBAFF,eAKE;AAAQ,UAAA,SAAS,EAAC,kBAAlB;AAAqC,UAAA,OAAO,EAAEE,CAAC,IAAIJ,WAAW,EAA9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAeD,CAtCD;;KAAMD,Y;AAwCN,eAAeA,YAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react'\r\n\r\nconst MessageModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n // useEffect(() => {\r\n // const pageClickEvent = (e) => {\r\n // if (messageModalRef.current !== null && !messageModalRef.current.contains(e.target)) {\r\n // toggleModalVisible()\r\n // }\r\n // };\r\n\r\n // // If the item is active (ie open) then listen for clicks\r\n // if (modalVisibilityState) {\r\n // window.addEventListener('click', pageClickEvent);\r\n // }\r\n\r\n // return () => {\r\n // window.removeEventListener('click', pageClickEvent);\r\n // }\r\n\r\n // }, [modalVisibilityState]);\r\n\r\n return (\r\n <div className=\"modal background\" onClick={e => removeModal()}>\r\n <div className=\"modal-content\">\r\n <div className=\"submitOkModal\">\r\n <h2>{headerMessage}</h2>\r\n <label>\r\n {bodyMessage}\r\n </label>\r\n <button className=\"formSubmitButton\" onClick={e => removeModal()}>\r\n Ok\r\n </button>\r\n </div>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default MessageModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = ({\n loginFormUsername\n}) => {\n _s();\n\n // Submit ok modal\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false);\n const submitOkModalRef = useRef(null);\n\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState); // Forgot password form\n\n\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => showForgotPasswordForm(!forgotPasswordFormVisibilityState);\n\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n setUsername(loginFormUsername.username);\n }, []);\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n useEffect(() => {\n const pageClickEvent = e => {\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\n toggleSubmitOkModalVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (submitOkModalVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [submitOkModalVisibilityState]);\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: JSON.stringify({\n email: `${username}`\n })\n };\n\n const handlePasswordForgot = () => {\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: something went wrong\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// toggleSubmitOkModalVisible()\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${submitOkModalVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: submitOkModalRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"submitOkModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Email submitted!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 123,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: \"Ok\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 121,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 120,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 119,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"6nRVeLyPRLhEC+nG9QEudfxhhrM=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","PasswordForgotModal","loginFormUsername","submitOkModalVisibilityState","showSubmitOkModal","submitOkModalRef","toggleSubmitOkModalVisible","forgotPasswordFormVisibilityState","showForgotPasswordForm","forgotPasswordFormRef","toggleForgotPasswordFormVisible","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","ForgotPasswordRequestOptions","method","body","JSON","stringify","email","handlePasswordForgot","fetch","serviceAPI","ForgotPasswordURL","then","res","ok","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAA2B;AAAA;;AACrD;AACA,QAAM,CAACC,4BAAD,EAA+BC,iBAA/B,IAAoDR,QAAQ,CA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A;AAAA;AAAA;AAAA;AAAA;AAAA,kBALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAjCF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAkDD,CAjID;;GAAMJ,mB;;KAAAA,mB;AAmIN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\n\r\nconst PasswordForgotModal = ({ loginFormUsername }) => {\r\n // Submit ok modal\r\n const [submitOkModalVisibilityState, showSubmitOkModal] = useState(false)\r\n const submitOkModalRef = useRef(null)\r\n const toggleSubmitOkModalVisible = () => showSubmitOkModal(!submitOkModalVisibilityState)\r\n\r\n // Forgot password form\r\n const [forgotPasswordFormVisibilityState, showForgotPasswordForm] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => showForgotPasswordForm(!forgotPasswordFormVisibilityState)\r\n\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n setUsername(loginFormUsername.username)\r\n }, [])\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (submitOkModalRef.current !== null && !submitOkModalRef.current.contains(e.target)) {\r\n toggleSubmitOkModalVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (submitOkModalVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [submitOkModalVisibilityState]);\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: JSON.stringify({\r\n email: `${username}`\r\n })\r\n }\r\n\r\n const handlePasswordForgot = () => {\r\n fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // toggleSubmitOkModalVisible()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n {/* SubmitOk modal */}\r\n <div className={`modal ${submitOkModalVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={submitOkModalRef} className=\"modal-content\">\r\n <div className=\"submitOkModal\">\r\n <h2>Email submitted!</h2>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Ok\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\passwordReset\\\\PasswordForgotModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useRef, useEffect } from 'react';\nimport config from '../../../config';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport \"./PasswordForgotModal.css\";\nimport MessageModal from '../../../components/messageModal/MessageModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst PasswordForgotModal = () => {\n _s();\n\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false);\n const forgotPasswordFormRef = useRef(null);\n\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState);\n\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\n const [username, setUsername] = useState('');\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n useEffect(() => {\n const pageClickEvent = e => {\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\n toggleForgotPasswordFormVisible();\n }\n }; // If the item is active (ie open) then listen for clicks\n\n\n if (forgotPasswordFormVisibilityState) {\n window.addEventListener('click', pageClickEvent);\n }\n\n return () => {\n window.removeEventListener('click', pageClickEvent);\n };\n }, [forgotPasswordFormVisibilityState]);\n const userInputData = JSON.stringify({\n email: `${username}`\n });\n const ForgotPasswordRequestOptions = {\n method: 'PUT',\n body: userInputData\n };\n\n const handlePasswordForgot = e => {\n e.preventDefault();\n toggleForgotPasswordFormVisible();\n setSubmitOkMessageModalState(true); // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // window.alert(\"Error: something went wrong\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // toggleSubmitOkModalVisible()\n // }\n // })\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"password-forgot-prompt\",\n children: /*#__PURE__*/_jsxDEV(\"span\", {\n children: /*#__PURE__*/_jsxDEV(\"a\", {\n onClick: toggleForgotPasswordFormVisible,\n children: \"Forgot password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n ref: forgotPasswordFormRef,\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"recoverPasswordForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Recover password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handlePasswordForgot,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 80,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n children: /*#__PURE__*/_jsxDEV(MessageModal, {\n removeModal: () => setSubmitOkMessageModalState(false),\n headerMessage: \"Email submitted!\",\n bodyMessage: \"An email with a password recovery link will be sent if it is registered in our system\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 5\n }, this);\n};\n\n_s(PasswordForgotModal, \"g4WkMIawwrBahYMYonVecg/0JA0=\");\n\n_c = PasswordForgotModal;\nexport default PasswordForgotModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"PasswordForgotModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/passwordReset/PasswordForgotModal.jsx"],"names":["React","useState","useRef","useEffect","config","FontAwesomeIcon","MessageModal","PasswordForgotModal","forgotPasswordFormVisibilityState","setForgotPasswordFormVisibilityState","forgotPasswordFormRef","toggleForgotPasswordFormVisible","submitOkMessageModalState","setSubmitOkMessageModalState","username","setUsername","handleUsernameChange","e","target","value","pageClickEvent","current","contains","window","addEventListener","removeEventListener","userInputData","JSON","stringify","email","ForgotPasswordRequestOptions","method","body","handlePasswordForgot","preventDefault"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,MAA1B,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAO,2BAAP;AACA,OAAOC,YAAP,MAAyB,+CAAzB;;;AAEA,MAAMC,mBAAmB,GAAG,MAAM;AAAA;;AAChC,QAAM,CAACC,iCAAD,EAAoCC,oCAApC,IAA4ER,QAAQ,CAAC,KAAD,CAA1F;AACA,QAAMS,qBAAqB,GAAGR,MAAM,CAAC,IAAD,CAApC;;AACA,QAAMS,+BAA+B,GAAG,MAAMF,oCAAoC,CAAC,CAACD,iCAAF,CAAlF;;AAEA,QAAM,CAACI,yBAAD,EAA4BC,4BAA5B,IAA4DZ,QAAQ,CAAC,KAAD,CAA1E;AAEA,QAAM,CAACa,QAAD,EAAWC,WAAX,IAA0Bd,QAAQ,CAAC,EAAD,CAAxC;;AACA,QAAMe,oBAAoB,GAAIC,CAAD,IAAO;AAClCF,IAAAA,WAAW,CAACE,CAAC,CAACC,MAAF,CAASC,KAAV,CAAX;AACD,GAFD;;AAIAhB,EAAAA,SAAS,CAAC,MAAM;AACd,UAAMiB,cAAc,GAAIH,CAAD,IAAO;AAC5B,UAAIP,qBAAqB,CAACW,OAAtB,KAAkC,IAAlC,IAA0C,CAACX,qBAAqB,CAACW,OAAtB,CAA8BC,QAA9B,CAAuCL,CAAC,CAACC,MAAzC,CAA/C,EAAiG;AAC/FP,QAAAA,+BAA+B;AAChC;AACF,KAJD,CADc,CAOd;;;AACA,QAAIH,iCAAJ,EAAuC;AAC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;AAEE,gBAAA,KAAK,EAAEnB,QAFT;AAGE,gBAAA,QAAQ,EAAEE;AAHZ;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAQE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBARF,eAWE;AAAQ,cAAA,SAAS,EAAC,kBAAlB;AAAqC,cAAA,IAAI,EAAC,QAA1C;AAAA,wDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,oBAXF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YARF,eA+BE;AAAA,6BACE,QAAC,YAAD;AAAc,QAAA,WAAW,EAAE,MAAMH,4BAA4B,CAAC,KAAD,CAA7D;AAAsE,QAAA,aAAa,EAAE,kBAArF;AAAyG,QAAA,WAAW,EAAE;AAAtH;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YA/BF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAsCD,CA/FD;;GAAMN,mB;;KAAAA,mB;AAiGN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\nconst PasswordForgotModal = () => {\r\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState)\r\n\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const [username, setUsername] = useState('');\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n\r\n toggleForgotPasswordFormVisible()\r\n setSubmitOkMessageModalState(true)\r\n // fetch(config.serviceAPI.ForgotPasswordURL, ForgotPasswordRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // window.alert(\"Error: something went wrong\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // toggleSubmitOkModalVisible()\r\n // }\r\n // })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div>\r\n <MessageModal removeModal={() => setSubmitOkMessageModalState(false)} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\messageModal\\\\MessageModal.jsx\",\n _s = $RefreshSig$();\n\nimport React from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst MessageModal = props => {\n _s();\n\n const [modalVisibilityState, showModal] = useState(true);\n\n const toggleModalVisible = () => showModal(!modalVisibilityState);\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${modalVisibilityState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"submitOkModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: props.headerMessage\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 11,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: props.bodyMessage\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n onClick: toggleModalVisible,\n children: \"Ok\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 15,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 10,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 8,\n columnNumber: 5\n }, this);\n};\n\n_s(MessageModal, \"o5WiWLNLIkTfnrQf/aeRT17JQYs=\");\n\n_c = MessageModal;\nexport default MessageModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"MessageModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/messageModal/MessageModal.jsx"],"names":["React","MessageModal","props","modalVisibilityState","showModal","useState","toggleModalVisible","headerMessage","bodyMessage"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;;;AAEA,MAAMC,YAAY,GAAIC,KAAD,IAAW;AAAA;;AAC9B,QAAM,CAACC,oBAAD,EAAuBC,SAAvB,IAAoCC,QAAQ,CAAC,IAAD,CAAlD;;AACA,QAAMC,kBAAkB,GAAG,MAAMF,SAAS,CAAC,CAACD,oBAAF,CAA1C;;AAEA,sBACE;AAAK,IAAA,SAAS,EAAG,SAAQA,oBAAoB,GAAG,QAAH,GAAc,UAAW,EAAtE;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,eAAf;AAAA,6BACE;AAAK,QAAA,SAAS,EAAC,eAAf;AAAA,gCACE;AAAA,oBAAKD,KAAK,CAACK;AAAX;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE;AAAA,oBACGL,KAAK,CAACM;AADT;AAAA;AAAA;AAAA;AAAA,gBAFF,eAKE;AAAQ,UAAA,SAAS,EAAC,kBAAlB;AAAqC,UAAA,OAAO,EAAEF,kBAA9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAeD,CAnBD;;GAAML,Y;;KAAAA,Y;AAqBN,eAAeA,YAAf","sourcesContent":["import React from 'react'\r\n\r\nconst MessageModal = (props) => {\r\n const [modalVisibilityState, showModal] = useState(true)\r\n const toggleModalVisible = () => showModal(!modalVisibilityState)\r\n\r\n return (\r\n <div className={`modal ${modalVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div className=\"modal-content\">\r\n <div className=\"submitOkModal\">\r\n <h2>{props.headerMessage}</h2>\r\n <label>\r\n {props.bodyMessage}\r\n </label>\r\n <button className=\"formSubmitButton\" onClick={toggleModalVisible}>\r\n Ok\r\n </button>\r\n </div>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default MessageModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\login\\\\Login.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { Redirect } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Login.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { NavLink } from 'react-router-dom';\nimport signUp from './signUp/SignUp';\nimport config from '../../config';\nimport SignUp from './signUp/SignUp';\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Login = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [sessionToken, setSessionToken] = useState();\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [forgotUsername, setForgotUsername] = useState('');\n useEffect(() => {\n setForgotUsername(username);\n console.log(forgotUsername);\n }, [username]);\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const handlePasswordChange = e => {\n setPassword(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${username}`,\n password: `${password}`\n });\n const loginRequestOptions = {\n method: 'POST',\n body: userInputData\n };\n\n const handleSignInFormSubmit = e => {\n e.preventDefault();\n oktaAuth.signInWithCredentials({\n username,\n password\n }).then(res => {\n const sessionToken = res.sessionToken;\n setSessionToken(sessionToken); // sessionToken is a one-use token, so make sure this is only called once\n\n oktaAuth.signInWithRedirect({\n sessionToken,\n originalUri: '/home'\n });\n }).catch(err => console.log('Found an error', err));\n };\n\n if (sessionToken) {\n // Hide form while sessionToken is converted into id/access tokens\n return null;\n }\n\n if (!authState || !authState.isAuthenticated) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageContainer\",\n children: [/*#__PURE__*/_jsxDEV(SignUp, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"signInForm\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Sign in to PipIt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleSignInFormSubmit,\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"username\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Password:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"password\",\n type: \"password\",\n value: password,\n onChange: handlePasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n type: \"submit\",\n children: [\"Sign in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 69,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(PasswordForgotModal, {\n loginFormUsername: forgotUsername\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 7\n }, this);\n } else {\n return /*#__PURE__*/_jsxDEV(Redirect, {\n to: \"/home\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 12\n }, this);\n }\n};\n\n_s(Login, \"8cak91jM2hAuqTZEX5oSChwgzO4=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Login;\nexport default Login;\n\nvar _c;\n\n$RefreshReg$(_c, \"Login\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/login/Login.jsx"],"names":["React","useState","useEffect","useRef","Redirect","useOktaAuth","FontAwesomeIcon","NavLink","signUp","config","SignUp","PasswordForgotModal","Login","authState","oktaAuth","sessionToken","setSessionToken","username","setUsername","password","setPassword","forgotUsername","setForgotUsername","console","log","handleUsernameChange","e","target","value","handlePasswordChange","userInputData","JSON","stringify","email","loginRequestOptions","method","body","handleSignInFormSubmit","preventDefault","signInWithCredentials","then","res","signInWithRedirect","originalUri","catch","err","isAuthenticated"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,aAAP;AACA,SAASC,eAA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AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAQ,YAAA,SAAS,EAAC,kBAAlB;AAAqC,YAAA,IAAI,EAAC,QAA1C;AAAA,uDAEE,QAAC,eAAD;AAAiB,cAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF;AAAA;AAAA;AAAA;AAAA;AAAA,gBAFF,eAsBE,QAAC,mBAAD;AAAqB,UAAA,iBAAiB,EAAER;AAAxC;AAAA;AAAA;AAAA;AAAA,gBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA,cAHF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF;AA8BD,GA/BD,MA+BO;AACL,wBAAO,QAAC,QAAD;AAAU,MAAA,EAAE,EAAC;AAAb;AAAA;AAAA;AAAA;AAAA,YAAP;AACD;AACF,CApFD;;GAAMT,K;UAC4BP,W;;;KAD5BO,K;AAsFN,eAAeA,KAAf","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\nimport config from '../../config';\r\nimport SignUp from './signUp/SignUp';\r\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [forgotUsername, setForgotUsername] = useState('')\r\n\r\n\r\n useEffect(() => {\r\n setForgotUsername(username)\r\n console.log(forgotUsername)\r\n }, [username])\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <PasswordForgotModal loginFormUsername={forgotUsername} />\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment