Преглед изворни кода

fix: renamge password fill to make sure it's not being auto-fileld

poeti8 пре 6 година
родитељ
комит
c576ac2bb9
1 измењених фајлова са 8 додато и 5 уклоњено
  1. 8 5
      client/components/Settings/SettingsDeleteAccount.tsx

+ 8 - 5
client/components/Settings/SettingsDeleteAccount.tsx

@@ -15,9 +15,12 @@ import Icon from "../Icon";
 const SettingsDeleteAccount: FC = () => {
   const [message, setMessage] = useMessage(1500);
   const [loading, setLoading] = useState(false);
-  const [formState, { password, label }] = useFormState(null, {
-    withIds: true
-  });
+  const [formState, { password, label }] = useFormState<{ accpass: string }>(
+    null,
+    {
+      withIds: true
+    }
+  );
 
   const onSubmit = async e => {
     e.preventDefault();
@@ -26,7 +29,7 @@ const SettingsDeleteAccount: FC = () => {
     try {
       await axios.post(
         `${APIv2.Users}/delete`,
-        formState.values,
+        { password: formState.values.accpass },
         getAxiosConfig()
       );
       Router.push("/logout");
@@ -57,7 +60,7 @@ const SettingsDeleteAccount: FC = () => {
       </Text>
       <RowCenterV as="form" onSubmit={onSubmit}>
         <TextInput
-          {...password("password")}
+          {...password("accpass")}
           placeholder="Password..."
           autocomplete="off"
           mr={3}