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6C,EACF7D,EAAI8D,QAAQ,CAACC,OAAO,CAACC,MAAM,CACzB,aACD,CAAG,UAA6BhF,MAAA,CAAnB6E,EAAYI,MAAM,EAEhC,OAAOjE,EAAI8D,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,aAAgB,EAQvDhE,EAAIkE,YAAY,CAACrC,QAAQ,CAACsC,GAAG,CAC3B,GAASC,EACT,QACM1C,EAAgCA,EAUpC,MAVIA,CAAAA,CAAAA,OAAAA,CAAAA,EAAAA,EAAIG,QAAQ,GAAZH,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,EAAc2C,MAAM,IAAK,KAAO3C,CAAAA,OAAAA,CAAAA,EAAAA,EAAIG,QAAQ,GAAZH,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,EAAc2C,MAAM,IAAK,MAErD9C,WAAAA,OAAOC,QAAQ,CAAC8C,QAAQ,EAC1B/C,CAAAA,OAAOC,QAAQ,CAACC,IAAI,CAAG,WAOtB/E,QAAQ6H,MAAM,CAAC7C,EACxB,sBCvCF8C,EAAAC,OAAA,EAAkB,oNCAlBD,EAAAC,OAAA,EAAkB,8HCAlBD,EAAAC,OAAA,EAAkB,gLCAlBD,EAAAC,OAAA,EAAkB","sources":["webpack://_N_E/?48d5","webpack://_N_E/./src/components/Input/index.tsx","webpack://_N_E/./src/components/Checkbox/index.tsx","webpack://_N_E/./src/services/api/User.ts","webpack://_N_E/./src/components/Form/Login/index.tsx","webpack://_N_E/./src/services/api/index.ts","webpack://_N_E/./src/app/login/styles.module.css","webpack://_N_E/./src/components/Checkbox/styles.module.css","webpack://_N_E/./src/components/Form/Login/styles.module.css","webpack://_N_E/./src/components/Input/styles.module.css","webpack://_N_E/"],"sourcesContent":["import(/* webpackMode: \"eager\" */ \"/codebuild/output/src2966471232/src/verus_main_frontend/node_modules/next/dist/client/image-component.js\");\nimport(/* webpackMode: \"eager\" */ \"/codebuild/output/src2966471232/src/verus_main_frontend/node_modules/next/dist/client/link.js\");\nimport(/* webpackMode: \"eager\" */ \"/codebuild/output/src2966471232/src/verus_main_frontend/src/app/login/styles.module.css\");\nimport(/* webpackMode: \"eager\" */ \"/codebuild/output/src2966471232/src/verus_main_frontend/src/components/Form/Login/index.tsx\")","import { useState } from \"react\";\nimport Image from \"next/image\";\nimport InputMask from \"react-input-mask\";\nimport { BaiJamjureeFont } from \"@/styles/typography\";\nimport styles from \"./styles.module.css\";\nimport { IInputProps } from \"./types\";\n\nexport default function Input({\n flex,\n mask,\n width,\n icon,\n iconTopOffset = \"1.65rem\",\n error,\n ...rest\n}: Readonly) {\n const [isPasswordVisible, setIsPasswordVisible] = useState(false);\n\n const hasError = Boolean(error);\n\n const togglePasswordVisibility = () => {\n setIsPasswordVisible((prev) => !prev);\n };\n\n return (\n
\n {rest.label && }\n\n {icon && (\n \n )}\n\n {/* @ts-ignore */}\n \n\n {rest.type === \"password\" && (\n \n )}\n\n {hasError &&

{error}

}\n
\n );\n}\n","import styles from \"./styles.module.css\";\nimport { ICheckboxProps } from \"./types\";\n\nexport default function Checkbox({\n orientation = \"row\",\n error,\n ...rest\n}: Readonly) {\n const hasError = Boolean(error);\n\n return (\n <>\n \n {\n if (rest.onChange) {\n rest.onChange(event);\n }\n }}\n />\n {rest.label && }\n \n {hasError &&

{error}

}\n \n );\n}\n","import { type ICredentials, api } from \".\";\nimport type { IUser } from \"@/models\";\nimport type { ILoginFormValues } from \"@/components/Form/Login/types\";\n\nexport const UserService = {\n Login: (values: ILoginFormValues) => {\n // @ts-ignore local field only\n delete values.remember_me;\n\n return api.post(\"token/\", values);\n },\n\n GetCurrent: () => {\n return api.get(\"int/current_user\");\n },\n};\n","\"use client\";\n\nimport { useRef } from \"react\";\nimport Image from \"next/image\";\nimport Swal from \"sweetalert2\";\nimport { setCookie } from \"nookies\";\nimport { Formik, FormikProps } from \"formik\";\nimport * as Yup from \"yup\";\nimport Input from \"@/components/Input\";\nimport Checkbox from \"@/components/Checkbox\";\nimport { setAuthHeader } from \"@/services/api\";\nimport { UserService } from \"@/services/api/User\";\nimport styles from \"./styles.module.css\";\nimport { ILoginFormValues } from \"./types\";\nimport Link from \"next/link\";\n\nconst LoginFormSchema = Yup.object().shape({\n username: Yup.string().required(\"Username is required\"),\n password: Yup.string().required(\"Password is required\"),\n remember_me: Yup.boolean(),\n});\n\nexport default function LoginForm() {\n const formRef = useRef>(null);\n\n const handleFormSubmit = async (values: ILoginFormValues) => {\n try {\n const loginRes = (await UserService.Login(values)).data;\n setAuthHeader(loginRes);\n setCookie(null, \"auth\", btoa(JSON.stringify(loginRes)), {\n maxAge: values.remember_me ? 30 * 24 * 60 * 60 : undefined,\n });\n window.location.href = \"/\";\n } catch (err: any) {\n formRef.current?.setErrors(err?.response?.data ?? {});\n Swal.fire({\n title: \"Error\",\n text:\n err?.response?.data?.detail ??\n err?.response?.data?.non_field_errors?.join(\", \") ??\n err?.message ??\n \"An error occurred while logging in. Please, try again later.\",\n icon: \"error\",\n });\n }\n };\n\n return (\n \n {({\n values,\n errors,\n touched,\n setFieldValue,\n handleChange,\n handleSubmit,\n isSubmitting,\n }) => (\n
\n \n\n \n \n\n \n \n\n {\n setFieldValue(\"remember_me\", !values.remember_me);\n }}\n />\n\n \n\n \n Disclaimer\n \n \n )}\n \n );\n}\n","import { redirect } from \"next/navigation\";\nimport axios from \"axios\";\n\nexport interface ICredentials {\n access: string;\n refresh: string;\n}\n\nexport const api = axios.create({\n baseURL: `${process.env.API_BASE_URL}/api`,\n});\n\nexport const setAuthHeader = (credentials?: ICredentials) => {\n if (credentials) {\n api.defaults.headers.common[\n \"Authorization\"\n ] = `Bearer ${credentials.access}`;\n } else {\n delete api.defaults.headers.common[\"Authorization\"];\n }\n};\n\nexport const setForwardedForHeader = (ip: unknown) => {\n api.defaults.headers.common[\"X-Forwarded-For\"] = ip as string;\n};\n\napi.interceptors.response.use(\n (res) => res,\n (err) => {\n if (err.response?.status === 401 || err.response?.status === 403) {\n if (typeof window !== \"undefined\") {\n if (window.location.pathname !== \"/login\") {\n window.location.href = \"/logout\";\n }\n } else {\n redirect(\"/logout\");\n }\n }\n\n return Promise.reject(err);\n }\n);\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"styles_container__RuiLu\",\"container-auth-image\":\"styles_container-auth-image__1G7OM\",\"container-form\":\"styles_container-form__ZwXrz\",\"txt-powered-by\":\"styles_txt-powered-by__rZdiK\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"styles_container__qz7_H\",\"border\":\"styles_border__Ipi9w\",\"text-error\":\"styles_text-error__EXBks\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"auth-form\":\"styles_auth-form__1ncLZ\",\"logo\":\"styles_logo__e8Rlu\",\"form-inputs\":\"styles_form-inputs__8Am86\",\"disclaimer-link\":\"styles_disclaimer-link__jl3GL\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"styles_container__N96d4\",\"with-icon\":\"styles_with-icon__RiAiS\",\"btn-toggle-password-visibility\":\"styles_btn-toggle-password-visibility__6gFw1\",\"icon\":\"styles_icon__mrOrW\",\"text-error\":\"styles_text-error__Ciwaa\"};"],"names":["Promise","resolve","then","__webpack_require__","t","bind","Input","param","flex","mask","width","icon","iconTopOffset","error","rest","isPasswordVisible","setIsPasswordVisible","useState","hasError","Boolean","jsx_runtime","jsxs","div","style","className","styles","label","jsx","htmlFor","name","Image","top","src","height","alt","InputMask","fontFamily","BaiJamjureeFont","concat","type","onClick","prev","p","Checkbox","orientation","Fragment","flexDirection","input","onChange","event","UserService","Login","values","remember_me","api","post","GetCurrent","get","LoginFormSchema","Yup","shape","username","required","password","LoginForm","formRef","useRef","handleFormSubmit","loginRes","data","setAuthHeader","setCookie","btoa","JSON","stringify","maxAge","undefined","window","location","href","err","current","setErrors","response","Swal","title","text","detail","non_field_errors","join","message","Formik","innerRef","initialValues","validationSchema","onSubmit","errors","touched","setFieldValue","handleChange","handleSubmit","isSubmitting","form","sizes","span","placeholder","value","disabled","checked","button","Link","axios","create","baseURL","process","credentials","defaults","headers","common","access","interceptors","use","res","status","pathname","reject","module","exports"],"sourceRoot":""}