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AAU,oCACVsB,KAAK,SAAQxB,SACd,iBAKLC,EAAAA,EAAAA,KAACiC,EAAAA,EAAY,CACXC,QAASnD,EACTK,QAASH,EAAYG,QACrB0C,QArYQK,KACdlD,EAAYI,UACdL,GAAa,GACbhB,EAASiB,EAAYK,MAErBN,GAAa,EACf,EAgYUoD,YAAY,6BAEdpC,EAAAA,EAAAA,KAACqC,EAAAA,EAAY,CAACH,QAAS3C,EAAS6C,YAAY,4BAMxD,C","sources":["views/ubah-password/index.js"],"sourcesContent":["import { useState } from \"react\";\r\nimport ConfirmAlert from \"../../component/alert/confirmAlert\";\r\nimport LoadingAlert from \"../../component/alert/loadingAlert\";\r\nimport { Link, useNavigate } from \"react-router-dom\";\r\nimport { updatePasswordById } from \"../../services/API\";\r\n\r\nfunction UpdatePassword() {\r\n const navigate = useNavigate();\r\n const [oldPassword, setOldPassword] = useState(\"\");\r\n const [newPassword, setNewPassword] = useState(\"\");\r\n const [repeatPassword, setRepeatPassword] = useState(\"\");\r\n const [errorNewPassword, setErrorNewPassword] = useState(\"\");\r\n const [errorOldPassword, setErrorOldPassword] = useState(\"\");\r\n const [errorRepeatPassword, setErrorRepeatPassword] = useState(\"\");\r\n const [showPopup, setShowPopup] = useState(false);\r\n const [alertOption, setAlertOption] = useState({\r\n title: \"\",\r\n message: \"\",\r\n redirect: \"\",\r\n url: \"\",\r\n });\r\n const [loading, setLoading] = useState(false);\r\n const [typeInput, setTypeInput] = useState([\r\n \"password\",\r\n \"password\",\r\n \"password\",\r\n ]);\r\n const [iconClass, setIconClass] = useState([\"fa-eye\", \"fa-eye\", \"fa-eye\"]);\r\n\r\n const handlePopup = () => {\r\n if (alertOption.redirect) {\r\n setShowPopup(false);\r\n navigate(alertOption.url);\r\n } else {\r\n setShowPopup(false);\r\n }\r\n };\r\n\r\n async function submit(e) {\r\n e.preventDefault();\r\n if (newPassword === \"\") setErrorNewPassword(\"Silahkan isi kata sandi baru\");\r\n if (oldPassword === \"\") setErrorOldPassword(\"Silahkan isi kata sandi lama\");\r\n if (repeatPassword === \"\")\r\n setErrorRepeatPassword(\"Silahkan ulangi isi kata sandi\");\r\n if (newPassword !== repeatPassword) {\r\n setShowPopup(true);\r\n setAlertOption({\r\n title: \"\",\r\n message: \"Inputkan konfirmasi password sesuai password baru\",\r\n redirect: false,\r\n });\r\n return;\r\n }\r\n if (\r\n oldPassword === newPassword &&\r\n oldPassword !== \"\" &&\r\n newPassword !== \"\" &&\r\n repeatPassword\r\n ) {\r\n setShowPopup(true);\r\n setAlertOption({\r\n title: \"\",\r\n message: \"Password baru sama dengan password lama\",\r\n redirect: false,\r\n url: \"\",\r\n });\r\n return;\r\n }\r\n if (oldPassword !== \"\" && newPassword !== \"\" && repeatPassword !== \"\") {\r\n setLoading(true);\r\n const res = await updatePasswordById({\r\n userid: localStorage.getItem(\"id\"),\r\n oldPassword: oldPassword,\r\n newPassword: newPassword,\r\n });\r\n setLoading(false);\r\n if (res.status === 200 && res.data !== null) {\r\n if (res.data === \"Old password not match\") {\r\n setShowPopup(true);\r\n // setAlertOption({title: '', message: res.data, redirect: false, url: ''})\r\n setAlertOption({\r\n title: \"\",\r\n message: \"Password lama tidak cocok. Silakan coba lagi\",\r\n redirect: false,\r\n url: \"\",\r\n });\r\n } else if (res.data === \"Userid not found\") {\r\n setShowPopup(true);\r\n setAlertOption({\r\n title: \"\",\r\n message: \"Gagal ubah password. Silakan coba lagi\",\r\n redirect: false,\r\n url: \"\",\r\n });\r\n } else if (res.data.includes(\"Succes\")) {\r\n setShowPopup(true);\r\n setAlertOption({\r\n title: \"\",\r\n message: \"Sukses ubah password\",\r\n redirect: true,\r\n url: \"/dashboard\",\r\n });\r\n } else if (res.data.includes(\"Password must be\")) {\r\n setShowPopup(true);\r\n setAlertOption({\r\n title: \"\",\r\n message: res.data,\r\n redirect: false,\r\n url: \"\",\r\n });\r\n } else {\r\n setShowPopup(true);\r\n setAlertOption({\r\n title: \"\",\r\n message: \"Gagal ubah password. \" + res.data,\r\n redirect: false,\r\n url: \"\",\r\n });\r\n }\r\n // console.log(res.data)\r\n }\r\n } else {\r\n setShowPopup(true);\r\n setAlertOption({\r\n title: \"error\",\r\n message: \"Harap isi seluruh data\",\r\n redirect: false,\r\n url: \"\",\r\n });\r\n }\r\n }\r\n\r\n const validationNewPassword = (e) => {\r\n e.preventDefault();\r\n setNewPassword(e.target.value);\r\n if (e.target.value === \"\") {\r\n setErrorNewPassword(\"Silahkan isi kata sandi baru\");\r\n return;\r\n }\r\n\r\n if (e.target.value.length < 12) {\r\n setErrorNewPassword(\"Kata sandi harus terdiri dari minimal 12 karakter. Kombinasi huruf besar, huruf kecil, angka, dan simbol\");\r\n return;\r\n }\r\n\r\n if (\r\n !e.target.value.match(\r\n /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{12,}$/\r\n )\r\n ) {\r\n setErrorNewPassword(\r\n \"Kata sandi harus terdiri dari minimal 12 karakter. Kombinasi huruf besar, huruf kecil, angka, dan simbol\"\r\n );\r\n return;\r\n }\r\n\r\n setErrorNewPassword(\"\");\r\n };\r\n\r\n const validationOldPassword = (e) => {\r\n e.preventDefault();\r\n setOldPassword(e.target.value);\r\n if (e.target.value === \"\") {\r\n setErrorOldPassword(\"Silahkan isi kata sandi lama\");\r\n return;\r\n }\r\n\r\n setErrorOldPassword(\"\");\r\n };\r\n\r\n const validationRepeatPassword = (e) => {\r\n e.preventDefault();\r\n setRepeatPassword(e.target.value);\r\n if (e.target.value === \"\") {\r\n setErrorRepeatPassword(\"Silahkan isi ulang kata sandi baru\");\r\n return;\r\n }\r\n if (e.target.value !== newPassword) {\r\n setErrorRepeatPassword(\"Masukkan sesuai kata sandi baru\");\r\n return;\r\n }\r\n\r\n if (e.target.value.length < 12) {\r\n setErrorRepeatPassword(\r\n \"Kata sandi harus terdiri dari minimal 12 karakter. Kombinasi huruf besar, huruf kecil, angka, dan simbol\"\r\n );\r\n return;\r\n }\r\n\r\n if (\r\n !e.target.value.match(\r\n /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{12,}$/\r\n )\r\n ) {\r\n setErrorRepeatPassword(\r\n \"Kata sandi harus terdiri dari minimal 12 karakter. Kombinasi huruf besar, huruf kecil, angka, dan simbol\"\r\n );\r\n return;\r\n }\r\n\r\n setErrorRepeatPassword(\"\");\r\n };\r\n\r\n return (\r\n <>\r\n
\r\n \r\n \r\n \r\n \r\n \r\n Ubah Kata Sandi\r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Masukkan Kata Sandi Lama\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n {\r\n setTypeInput([\r\n typeInput[0] === \"password\" ? \"text\" : \"password\",\r\n typeInput[1],\r\n typeInput[2],\r\n ]);\r\n setIconClass([\r\n typeInput[0] === \"password\"\r\n ? \"fa-eye-slash\"\r\n : \"fa-eye\",\r\n iconClass[1],\r\n iconClass[2],\r\n ]);\r\n }}\r\n >\r\n
\r\n
\r\n
\r\n
\r\n \r\n {errorOldPassword}\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Masukkan Kata Sandi Baru\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n {\r\n setTypeInput([\r\n typeInput[0],\r\n typeInput[1] === \"password\" ? \"text\" : \"password\",\r\n typeInput[2],\r\n ]);\r\n setIconClass([\r\n iconClass[0],\r\n typeInput[1] === \"password\"\r\n ? \"fa-eye-slash\"\r\n : \"fa-eye\",\r\n iconClass[2],\r\n ]);\r\n }}\r\n >\r\n
\r\n
\r\n
\r\n
\r\n \r\n {errorNewPassword}\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Ulangi Kata Sandi Baru\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n {\r\n setTypeInput([\r\n typeInput[0],\r\n typeInput[1],\r\n typeInput[2] === \"password\" ? \"text\" : \"password\",\r\n ]);\r\n setIconClass([\r\n iconClass[0],\r\n iconClass[1],\r\n typeInput[2] === \"password\"\r\n ? \"fa-eye-slash\"\r\n : \"fa-eye\",\r\n ]);\r\n }}\r\n >\r\n
\r\n
\r\n
\r\n
\r\n \r\n {\" \"}\r\n {errorRepeatPassword}{\" \"}\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Submit\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n );\r\n}\r\n\r\nexport default UpdatePassword;"],"names":["navigate","useNavigate","oldPassword","setOldPassword","useState","newPassword","setNewPassword","repeatPassword","setRepeatPassword","errorNewPassword","setErrorNewPassword","errorOldPassword","setErrorOldPassword","errorRepeatPassword","setErrorRepeatPassword","showPopup","setShowPopup","alertOption","setAlertOption","title","message","redirect","url","loading","setLoading","typeInput","setTypeInput","iconClass","setIconClass","_jsxs","_Fragment","children","_jsx","className","style","borderBottom","width","fontSize","Link","to","onSubmit","async","e","preventDefault","res","updatePasswordById","userid","localStorage","getItem","status","data","includes","backgroundColor","borderRadius","color","type","boxShadow","textDecoration","onChange","target","value","paddingLeft","onClick","length","match","ConfirmAlert","visible","handlePopup","customClass","LoadingAlert"],"sourceRoot":""}