mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-13 01:22:14 +00:00
set password form
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
symbolValidator,
|
||||
upperCaseValidator,
|
||||
} from "@/helpers/validators";
|
||||
import { registerUser, RegisterUserResponse } from "@/lib/server/register";
|
||||
import { RegisterUserResponse } from "@/lib/server/register";
|
||||
import { PasswordComplexitySettings } from "@zitadel/proto/zitadel/settings/v2/password_settings_pb";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -28,18 +28,12 @@ type Inputs =
|
||||
|
||||
type Props = {
|
||||
passwordComplexitySettings: PasswordComplexitySettings;
|
||||
email: string;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
organization?: string;
|
||||
authRequestId?: string;
|
||||
};
|
||||
|
||||
export function SetPasswordForm({
|
||||
passwordComplexitySettings,
|
||||
email,
|
||||
firstname,
|
||||
lastname,
|
||||
organization,
|
||||
authRequestId,
|
||||
}: Props) {
|
||||
@@ -47,11 +41,7 @@ export function SetPasswordForm({
|
||||
|
||||
const { register, handleSubmit, watch, formState } = useForm<Inputs>({
|
||||
mode: "onBlur",
|
||||
defaultValues: {
|
||||
email: email ?? "",
|
||||
firstname: firstname ?? "",
|
||||
lastname: lastname ?? "",
|
||||
},
|
||||
defaultValues: {},
|
||||
});
|
||||
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
@@ -61,10 +51,7 @@ export function SetPasswordForm({
|
||||
|
||||
async function submitRegister(values: Inputs) {
|
||||
setLoading(true);
|
||||
const response = await registerUser({
|
||||
email: email,
|
||||
firstName: firstname,
|
||||
lastName: lastname,
|
||||
const response = await changePassword({
|
||||
organization: organization,
|
||||
authRequestId: authRequestId,
|
||||
password: values.password,
|
||||
|
||||
Reference in New Issue
Block a user