mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 13:35:07 +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>
|
||||
|
||||
@@ -445,11 +445,6 @@ export async function verifyEmail(userId: string, verificationCode: string) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId the id of the user where the email should be set
|
||||
* @returns the newly set email
|
||||
*/
|
||||
export async function resendEmailCode(userId: string) {
|
||||
return userService.resendEmailCode(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user