mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
18 KiB
JSON
1 line
18 KiB
JSON
{"ast":null,"code":"var _jsxFileName = \"/app/src/Pages/Reset.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect, useContext } from 'react';\nimport '../App.css';\nimport './Reset.css';\nimport { Button } from 'reactstrap';\nimport { Formik, Form, Field } from 'formik';\nimport ScaleLoader from 'react-spinners/ScaleLoader';\nimport { validateResetPassword, sendPasswordReset } from '../Api/index';\nimport AuthContext from '../Contexts/AuthContext';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Reset = route => {\n _s();\n\n let boolTrue = true;\n const [loading, setLoading] = useState(true);\n const [reset, setReset] = useState({});\n const [sent, setSent] = useState(false);\n let {\n ResetPassword\n } = useContext(AuthContext);\n let reqToken = false;\n\n if (route && route.match && route.match.params && route.match.params.token) {\n reqToken = route.match.params.token;\n }\n\n const sendReset = values => {\n sendPasswordReset(values).then(() => {\n setSent(true);\n });\n };\n\n useEffect(() => {\n if (!reqToken) {\n setLoading(false);\n return false;\n }\n\n validateResetPassword(reqToken).then(data => {\n setReset(data);\n setLoading(false);\n });\n }, [reqToken]);\n\n if (loading) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: /*#__PURE__*/_jsxDEV(ScaleLoader, {\n color: \"#6AD7E5\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 44,\n columnNumber: 7\n }, this);\n }\n\n if (sent) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: /*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Check your email!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 7\n }, this);\n }\n\n if (!reqToken) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Reset Password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageBody\",\n children: /*#__PURE__*/_jsxDEV(Formik, {\n initialValues: {\n email: ''\n },\n onSubmit: values => sendReset(values),\n children: /*#__PURE__*/_jsxDEV(Form, {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 20\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"email\",\n type: \"email\",\n required: boolTrue,\n className: \"loginFields\"\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(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 18\n }, this), /*#__PURE__*/_jsxDEV(Button, {\n color: \"primary\",\n type: \"submit\",\n className: \"loginButton\",\n disabled: loading,\n children: loading ? /*#__PURE__*/_jsxDEV(ScaleLoader, {\n color: \"#FFF\",\n size: 35\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 25\n }, this) : \"Reset\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 71,\n columnNumber: 13\n }, this)\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, true, {\n fileName: _jsxFileName,\n lineNumber: 62,\n columnNumber: 7\n }, this);\n }\n\n if (reqToken && !reset.valid) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: \"Invalid Reset Token or Token expired\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 7\n }, this);\n }\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"pageWrapper\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n children: \"Reset Password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 105,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"resetBody\",\n children: /*#__PURE__*/_jsxDEV(Formik, {\n initialValues: {\n password: '',\n comfirmpassword: '',\n token: reqToken\n },\n onSubmit: values => ResetPassword(values),\n children: /*#__PURE__*/_jsxDEV(Form, {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"New Password\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 25\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"password\",\n type: \"password\",\n required: boolTrue,\n className: \"resetFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 116,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 123,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Confirm New Password\", /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 125,\n columnNumber: 33\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"comfirmpassword\",\n type: \"password\",\n required: boolTrue,\n className: \"resetFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 124,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(Field, {\n name: \"token\",\n type: \"hidden\",\n className: \"resetFields\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 133,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 138,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"br\", {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 138,\n columnNumber: 16\n }, this), /*#__PURE__*/_jsxDEV(Button, {\n color: \"primary\",\n type: \"submit\",\n className: \"loginButton\",\n disabled: loading,\n children: loading ? /*#__PURE__*/_jsxDEV(ScaleLoader, {\n color: \"#FFF\",\n size: 35\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 144,\n columnNumber: 23\n }, this) : \"Reset\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 139,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 5\n }, this);\n};\n\n_s(Reset, \"ErBGjjAx7cEc23SGzcGk2R8F/8Y=\");\n\n_c = Reset;\nexport default Reset;\n\nvar _c;\n\n$RefreshReg$(_c, \"Reset\");","map":{"version":3,"sources":["/app/src/Pages/Reset.js"],"names":["React","useState","useEffect","useContext","Button","Formik","Form","Field","ScaleLoader","validateResetPassword","sendPasswordReset","AuthContext","Reset","route","boolTrue","loading","setLoading","reset","setReset","sent","setSent","ResetPassword","reqToken","match","params","token","sendReset","values","then","data","email","valid","password","comfirmpassword"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,UAArC,QAAuD,OAAvD;AACA,OAAO,YAAP;AACA,OAAO,aAAP;AACA,SAASC,MAAT,QAAuB,YAAvB;AACA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,KAAvB,QAAoC,QAApC;AACA,OAAOC,WAAP,MAAwB,4BAAxB;AACA,SAASC,qBAAT,EAAgCC,iBAAhC,QAAyD,cAAzD;AACA,OAAOC,WAAP,MAAwB,yBAAxB;;;AAEA,MAAMC,KAAK,GAAIC,KAAD,IAAW;AAAA;;AACvB,MAAIC,QAAQ,GAAG,IAAf;AACA,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBf,QAAQ,CAAC,IAAD,CAAtC;AACA,QAAM,CAACgB,KAAD,EAAQC,QAAR,IAAoBjB,QAAQ,CAAC,EAAD,CAAlC;AACA,QAAM,CAACkB,IAAD,EAAOC,OAAP,IAAkBnB,QAAQ,CAAC,KAAD,CAAhC;AAEA,MAAI;AAAEoB,IAAAA;AAAF,MAAoBlB,UAAU,CAACQ,WAAD,CAAlC;AAEA,MAAIW,QAAQ,GAAG,KAAf;;AACA,MAAIT,KAAK,IAAIA,KAAK,CAACU,KAAf,IAAwBV,KAAK,CAACU,KAAN,CAAYC,MAApC,IAA8CX,KAAK,CAACU,KAAN,CAAYC,MAAZ,CAAmBC,KAArE,EAA4E;AAC1EH,IAAAA,QAAQ,GAAGT,KAAK,CAACU,KAAN,CAAYC,MAAZ,CAAmBC,KAA9B;AACD;;AAED,QAAMC,SAAS,GAAIC,MAAD,IAAY;AAC5BjB,IAAAA,iBAAiB,CAACiB,MAAD,CAAjB,CAA0BC,IAA1B,CAA+B,MAAM;AACnCR,MAAAA,OAAO,CAAC,IAAD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';\nimport './Reset.css';\nimport { Button } from 'reactstrap';\nimport { Formik, Form, Field } from 'formik';\nimport ScaleLoader from 'react-spinners/ScaleLoader';\nimport { validateResetPassword, sendPasswordReset } from '../Api/index';\nimport AuthContext from '../Contexts/AuthContext';\n\nconst Reset = (route) => {\n let boolTrue = true;\n const [loading, setLoading] = useState(true);\n const [reset, setReset] = useState({});\n const [sent, setSent] = useState(false);\n\n let { ResetPassword } = useContext(AuthContext);\n\n let reqToken = false;\n if (route && route.match && route.match.params && route.match.params.token) {\n reqToken = route.match.params.token\n }\n\n const sendReset = (values) => {\n sendPasswordReset(values).then(() => {\n setSent(true);\n });\n }\n\n useEffect(() => {\n if (!reqToken) {\n setLoading(false);\n return false;\n }\n\n validateResetPassword(reqToken)\n .then(data => {\n setReset(data);\n setLoading(false);\n })\n }, [reqToken])\n\n if (loading) {\n return (\n <div className=\"pageWrapper\">\n <ScaleLoader color=\"#6AD7E5\" />\n </div>\n )\n }\n\n if (sent) {\n return (\n <div className=\"pageWrapper\">\n <h1>\n Check your email!\n </h1>\n </div>\n )\n }\n\n if (!reqToken) {\n return (\n <div className=\"pageWrapper\">\n <h1>\n Reset Password\n </h1>\n <div className=\"pageBody\">\n <Formik\n initialValues={{ email: '' }}\n onSubmit={values => sendReset(values)}\n >\n <Form>\n <label>\n Email<br/>\n <Field\n name=\"email\"\n type=\"email\"\n required={boolTrue}\n className=\"loginFields\"\n />\n </label>\n <br/><br/>\n <Button\n color=\"primary\"\n type=\"submit\"\n className=\"loginButton\"\n disabled={loading}\n >{loading ? <ScaleLoader color=\"#FFF\" size={35} /> : \"Reset\"}</Button>\n </Form>\n </Formik>\n </div>\n </div>\n )\n }\n\n if (reqToken && !reset.valid) {\n return (\n <div className=\"pageWrapper\">\n Invalid Reset Token or Token expired\n </div>\n )\n }\n\n return (\n <div className=\"pageWrapper\">\n <h1>\n Reset Password\n </h1>\n <div className=\"resetBody\">\n <Formik\n initialValues={{ password: '', comfirmpassword: '', token: reqToken }}\n onSubmit={values => ResetPassword(values)}\n >\n <Form>\n <label>\n New Password<br/>\n <Field\n name=\"password\"\n type=\"password\"\n required={boolTrue}\n className=\"resetFields\"\n />\n </label>\n <br/>\n <label>\n Confirm New Password<br/>\n <Field\n name=\"comfirmpassword\"\n type=\"password\"\n required={boolTrue}\n className=\"resetFields\"\n />\n </label>\n <Field\n name=\"token\"\n type=\"hidden\"\n className=\"resetFields\"\n />\n <br/><br/>\n <Button\n color=\"primary\"\n type=\"submit\"\n className=\"loginButton\"\n disabled={loading}\n >{loading ? <ScaleLoader color=\"#FFF\" size={35} /> : \"Reset\"}</Button>\n </Form>\n </Formik>\n </div>\n </div>\n );\n}\n\nexport default Reset;\n"]},"metadata":{},"sourceType":"module"} |