mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 14:54:33 +00:00
reset password link
This commit is contained in:
@@ -76,6 +76,33 @@ export default function PasswordForm({
|
||||
return response;
|
||||
}
|
||||
|
||||
async function resetPassword() {
|
||||
setError("");
|
||||
setLoading(true);
|
||||
|
||||
const res = await fetch("/api/resetpassword", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
loginName,
|
||||
organization,
|
||||
authRequestId,
|
||||
}),
|
||||
});
|
||||
|
||||
const response = await res.json();
|
||||
|
||||
setLoading(false);
|
||||
if (!res.ok) {
|
||||
console.log(response.details.details);
|
||||
setError(response.details?.details ?? "Could not verify password");
|
||||
return Promise.reject(response.details);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
function submitPasswordAndContinue(value: Inputs): Promise<boolean | void> {
|
||||
return submitPassword(value).then((resp) => {
|
||||
// if user has mfa -> /otp/[method] or /u2f
|
||||
@@ -201,6 +228,13 @@ export default function PasswordForm({
|
||||
label="Password"
|
||||
// error={errors.username?.message as string}
|
||||
/>
|
||||
<button
|
||||
className="transition-all text-sm hover:text-primary-light-500 dark:hover:text-primary-dark-500"
|
||||
onClick={() => resetPassword()}
|
||||
disabled={loading}
|
||||
>
|
||||
Reset Password
|
||||
</button>
|
||||
|
||||
{loginName && (
|
||||
<input type="hidden" name="loginName" value={loginName} />
|
||||
|
||||
Reference in New Issue
Block a user