passwort ok
This commit is contained in:
@ -15,7 +15,7 @@ export default function PasswordReset()
|
||||
password2:''
|
||||
});
|
||||
|
||||
const { data, error, isLoading } = useSWR({'ptoken': passwordToken}, getPwToken);
|
||||
const { data, error, isLoading } = useSWR({'pwtoken': passwordToken}, getPwToken);
|
||||
// data ist dogdata, logindata holt sich getProfilData.php aus $_SESSION
|
||||
if (error) return (<div>failed to load</div>);
|
||||
if (isLoading) return (<div>loading...</div>);
|
||||
@ -27,6 +27,16 @@ export default function PasswordReset()
|
||||
})
|
||||
}
|
||||
|
||||
if(!data.success)
|
||||
{
|
||||
return(
|
||||
<div >
|
||||
<Toaster toastOptions={{ position: "top-center" }} />
|
||||
<h2>Email nicht mehr gültig!</h2>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const submitForm = async (e: React.FormEvent<HTMLFormElement>) =>
|
||||
{
|
||||
e.preventDefault();
|
||||
@ -53,17 +63,17 @@ export default function PasswordReset()
|
||||
sendData.append(key, values[index]);
|
||||
}
|
||||
|
||||
sendData.append('passwordToken', passwordToken!);
|
||||
sendData.append('id', data.data.id);
|
||||
|
||||
const data = await passwordReset(sendData);
|
||||
if(data.success)
|
||||
const dataRes = await passwordReset(sendData);
|
||||
if(dataRes.success)
|
||||
{
|
||||
toast.success('Erfolgreich Passwort geändert!');
|
||||
e.currentTarget.reset();
|
||||
}
|
||||
else if(!data.success && data.message)
|
||||
else if(!dataRes.success && dataRes.message)
|
||||
{
|
||||
toast.error(data.message);
|
||||
toast.error(dataRes.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user