♻️ Refactor and tweaks, rename UserCreateOpen to UserRegister and others (#1143)

This commit is contained in:
Alejandra
2024-04-01 22:53:33 -05:00
committed by GitHub
parent aed4db7521
commit 4239d93ea6
45 changed files with 537 additions and 518 deletions

View File

@@ -15,6 +15,7 @@ import { useMutation } from "react-query"
import { type ApiError, LoginService, type NewPassword } from "../client"
import { isLoggedIn } from "../hooks/useAuth"
import useCustomToast from "../hooks/useCustomToast"
import { confirmPasswordRules, passwordRules } from "../utils"
interface NewPasswordForm extends NewPassword {
confirm_password: string
@@ -93,13 +94,7 @@ function ResetPassword() {
<FormLabel htmlFor="password">Set Password</FormLabel>
<Input
id="password"
{...register("new_password", {
required: "Password is required",
minLength: {
value: 8,
message: "Password must be at least 8 characters",
},
})}
{...register("new_password", passwordRules())}
placeholder="Password"
type="password"
/>
@@ -111,12 +106,7 @@ function ResetPassword() {
<FormLabel htmlFor="confirm_password">Confirm Password</FormLabel>
<Input
id="confirm_password"
{...register("confirm_password", {
required: "Please confirm your password",
validate: (value) =>
value === getValues().new_password ||
"The passwords do not match",
})}
{...register("confirm_password", confirmPasswordRules(getValues))}
placeholder="Password"
type="password"
/>