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2D,KAAM,GAAIC,MAAO,EAAG,EAC5C,EACAoC,aAAa,QACb1D,MAAOA,MAAAA,EAAAA,KAAAA,EAAAA,EAAOtC,KAAK,CACnB8G,SAAUtE,EACV8D,KAAI,KAGN,GAAAhC,EAAAC,GAAA,EAACE,MAAAA,CAAIC,UAAU,4BACb,GAAAJ,EAAAC,GAAA,EAACqC,EAAAA,EAAMA,CAAAA,CACLC,OAAM,GACNlC,cAAY,gBACZmC,SAAU1E,GAAWF,EACrBE,QAASA,EACT2E,MAAM,OACNC,KAAK,KACLlB,MAAOpD,EAAkB,eAAiB,yBAkF5D","sources":["webpack://_N_E/?8f54","webpack://_N_E/./apis/auth/api.ts","webpack://_N_E/../../../src/icons/arrow-left.ts","webpack://_N_E/./src/features/auth/pages/forgot-page.tsx"],"sourcesContent":["import(/* webpackMode: \"eager\", webpackExports: [\"default\"] */ \"/codebuild/output/src2715070955/src/quickly-next/apps/frontend/src/features/auth/pages/forgot-page.tsx\");\n","import { fetchWithAuth, fetchWithOutAuth } from \"../interceptor\";\nimport { APIRequestSignupValidateT, APISignupValidateResponseT } from \"./types\";\n\nexport const signupValidate = async ({\n email,\n company_name,\n token,\n}: APIRequestSignupValidateT): Promise => {\n const response = await fetchWithOutAuth(`/auth/signup/validate`, {\n method: \"POST\",\n body: JSON.stringify({\n email,\n company_name,\n token,\n }),\n });\n return response;\n};\n\nexport const resendVerifyEmail = async (): Promise => {\n return fetchWithAuth(`/auth/user/resend`, { method: \"POST\" });\n};\n\nexport const forgot = async (email: string): Promise => {\n return fetchWithOutAuth(`/auth/forgot-pass`, {\n method: \"POST\",\n body: JSON.stringify({ email }),\n });\n};\n\nexport const verifyEmail = async (token: string): Promise => {\n return fetchWithOutAuth(`/auth/user/verify`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n};\n\nexport const forgotVerify = async (\n email: string,\n newpass: string,\n token: string\n): Promise => {\n return fetchWithOutAuth(`/auth/forgot-pass-verify`, {\n method: \"POST\",\n body: JSON.stringify({ email, newpass, token }),\n });\n};\n","import createLucideIcon from '../createLucideIcon';\nimport { IconNode } from '../types';\n\nexport const __iconNode: IconNode = [\n ['path', { d: 'm12 19-7-7 7-7', key: '1l729n' }],\n ['path', { d: 'M19 12H5', key: 'x3x0zl' }],\n];\n\n/**\n * @component @name ArrowLeft\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTIgMTktNy03IDctNyIgLz4KICA8cGF0aCBkPSJNMTkgMTJINSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/arrow-left\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ArrowLeft = createLucideIcon('ArrowLeft', __iconNode);\n\nexport default ArrowLeft;\n","\"use client\";\n\nimport { motion } from \"framer-motion\";\nimport { ArrowLeft } from \"lucide-react\";\nimport Link from \"next/link\";\nimport { useRouter, useSearchParams } from \"next/navigation\";\nimport { useEffect, useState } from \"react\";\nimport { forgot, forgotVerify } from \"../../../../apis/auth\";\nimport {\n Button,\n InlineAlert,\n TextInput,\n useToast,\n} from \"../../../shared/components\";\nimport { loginSchema, validateAndSetErrors } from \"../../../shared/schemas\";\n\nexport default function ForgotPage() {\n const router = useRouter();\n const params = useSearchParams();\n\n const { toast } = useToast();\n\n const [email, setEmail] = useState(\"\");\n const [newPass, setNewPass] = useState(\"\");\n const [newPassConfirm, setNewPassConfirm] = useState(\"\");\n const [formDisable, setFormDisable] = useState(false);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState();\n const [verifying, setVerifying] = useState(false);\n const [showSentMessage, setShowSentMessage] = useState(false);\n\n useEffect(() => {\n if (!params) return;\n const emailParam = params.get(\"email\");\n const tokenParam = params.get(\"token\");\n if (emailParam && tokenParam) {\n setEmail(emailParam);\n setVerifying(true);\n }\n }, [params]);\n\n const handleSendResetEmail = async (e: React.FormEvent) => {\n e.preventDefault();\n setLoading(true);\n\n const hasError = await validateAndSetErrors(\n loginSchema,\n { email },\n setError\n );\n\n if (hasError) {\n setLoading(false);\n return;\n }\n await forgot(email)\n .then((response) => {\n if (!response?.success) throw new Error(\"Something went wrong\");\n setShowSentMessage(true);\n })\n .catch((e) => console.error(e))\n .finally(() => setLoading(false));\n };\n\n const handleResetPassword = async (e: React.FormEvent) => {\n e.preventDefault();\n setLoading(true);\n\n if (verifying) {\n if (newPass !== newPassConfirm) {\n setFormDisable(true);\n setError({ email: \"\", pass: \"Passwords do not match\", other: \"\" });\n setLoading(false);\n return;\n } else {\n setEmail(email.trim().toLowerCase());\n\n await forgotVerify(\n email.trim().toLowerCase(),\n newPass,\n params?.get(\"token\") || \"\"\n )\n .then((req) => {\n if (!req?.success) {\n throw new Error(req?.message || \"Something went wrong\");\n }\n\n toast({\n variant: \"success\",\n title: \"Password updated successfully!\",\n });\n router.push(\"/login\");\n })\n .catch((e) => {\n console.error(e);\n setError((prev) => ({\n ...prev,\n other: e.toString(),\n }));\n })\n .finally(() => setLoading(false));\n }\n }\n };\n\n return (\n \n
\n
\n \n \n \n Back\n \n \n
\n\n {!verifying ? (\n
\n \n Reset your password\n
\n
\n Enter your email address associated with your account to reset\n your password.\n
\n\n {\n handleSendResetEmail(e);\n }}\n data-testid=\"forgot-password-form\"\n >\n {showSentMessage && (\n \n )}\n {\n setEmail(e.target.value);\n setError({ email: \"\", pass: \"\", other: \"\" });\n }}\n autoComplete=\"email\"\n error={error?.email}\n disabled={verifying}\n wide\n />\n\n
\n \n
\n \n
\n ) : (\n
\n \n New password\n
\n
\n Please enter a new password.\n
\n\n \n {\n setError({ email: \"\", pass: \"\", other: \"\" });\n setNewPass(e.target.value);\n setFormDisable(false);\n }}\n password\n required\n wide\n error={error?.pass ? \" \" : undefined}\n />\n {\n setError({ email: \"\", pass: \"\", other: \"\" });\n setNewPassConfirm(e.target.value);\n setFormDisable(false);\n }}\n password\n hint=\"Choose a password (min 8 characters)\"\n required\n wide\n error={error?.pass}\n />\n\n {!!error?.other && (\n
\n \n
\n )}\n\n
\n \n
\n \n \n )}\n \n \n );\n}\n"],"names":["Promise","resolve","then","__webpack_require__","bind","signupValidate","param","email","company_name","token","fetchWithOutAuth","method","body","JSON","stringify","resendVerifyEmail","fetchWithAuth","forgot","verifyEmail","headers","Authorization","concat","forgotVerify","newpass","ArrowLeft","createLucideIcon","d","key","ForgotPage","router","useRouter","params","useSearchParams","toast","useToast","setEmail","useState","newPass","setNewPass","newPassConfirm","setNewPassConfirm","formDisable","setFormDisable","loading","setLoading","error","setError","verifying","setVerifying","showSentMessage","setShowSentMessage","useEffect","emailParam","get","tokenParam","handleSendResetEmail","e","preventDefault","validateAndSetErrors","loginSchema","response","success","catch","console","finally","handleResetPassword","pass","other","trim","toLowerCase","req","message","variant","title","push","prev","toString","jsx_runtime","jsx","motion","div","className","data-testid","initial","animate","exit","transition","duration","ease","variants","hidden","opacity","x","visible","jsxs","Link","href","span","form","onSubmit","TextInput","label","name","autoComplete","value","onChange","target","password","required","wide","undefined","hint","InlineAlert","subtitle","type","Button","submit","disabled","color","size","dismissible","noIcon"],"sourceRoot":""}