mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-13 21:40:45 +00:00
resend password reset
This commit is contained in:
@@ -6,7 +6,11 @@ import {
|
||||
symbolValidator,
|
||||
upperCaseValidator,
|
||||
} from "@/helpers/validators";
|
||||
import { changePassword, sendPassword } from "@/lib/server/password";
|
||||
import {
|
||||
changePassword,
|
||||
resetPassword,
|
||||
sendPassword,
|
||||
} from "@/lib/server/password";
|
||||
import { create } from "@zitadel/client";
|
||||
import { ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
||||
import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
|
||||
@@ -62,6 +66,29 @@ export function SetPasswordForm({
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
async function resendCode() {
|
||||
setError("");
|
||||
setLoading(true);
|
||||
|
||||
const response = await resetPassword({
|
||||
loginName,
|
||||
organization,
|
||||
authRequestId,
|
||||
})
|
||||
.catch(() => {
|
||||
setError("Could not reset password");
|
||||
return;
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
|
||||
if (response && "error" in response) {
|
||||
setError(response.error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async function submitPassword(values: Inputs) {
|
||||
setLoading(true);
|
||||
let payload: { userId: string; password: string; code?: string } = {
|
||||
@@ -184,6 +211,8 @@ export function SetPasswordForm({
|
||||
<Button
|
||||
variant={ButtonVariants.Secondary}
|
||||
data-testid="resend-button"
|
||||
onClick={() => resendCode()}
|
||||
disabled={loading}
|
||||
>
|
||||
{t("set.resend")}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user