Change password

This commit is contained in:
2025-02-10 14:27:38 +08:00
parent e7d92377ce
commit 65f3d8af1e
3 changed files with 127 additions and 16 deletions

View File

@@ -4,6 +4,12 @@ import { useState } from "react";
import { toast } from "react-toastify";
import http, { login } from "../http";
export const validatePassword = (password: string): boolean => {
const passwordComplexityRegex =
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z\d])[A-Za-z\d@$!%*?&\\]{12,}$/;
return passwordComplexityRegex.test(password);
};
export default function SignupView({
onLogin,
email = "",
@@ -21,12 +27,6 @@ export default function SignupView({
const [confirmPassword, setConfirmPassword] = useState("");
const [signupEnabled, setSignupEnabled] = useState(true);
const validatePassword = (password: string): boolean => {
const passwordComplexityRegex =
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z\d])[A-Za-z\d@$!%*?&\\]{12,}$/;
return passwordComplexityRegex.test(password);
};
const validateFields = () => {
if (
!firstName ||