fix: replace vulnerable email regex with safe helper function
- Use isValidEmail from helpers instead of inline regex - Fixes SonarQube Security Hotspot for DoS via backtracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d192dad7e6
commit
a80d42271d
|
|
@ -7,6 +7,7 @@ import { registerSchema, RegisterFormData } from "@/lib/validations";
|
|||
import Link from "next/link";
|
||||
import TeaIconsBackground from "@/components/TeaIconsBackground";
|
||||
import { ROUTES, API_BASE_URL, API_ENDPOINTS } from "@/utils/constants";
|
||||
import { isValidEmail } from "@/utils/helpers";
|
||||
import ReCAPTCHA from "react-google-recaptcha";
|
||||
|
||||
export default function RegisterPage() {
|
||||
|
|
@ -42,7 +43,7 @@ export default function RegisterPage() {
|
|||
|
||||
// Vérifier si l'email existe déjà
|
||||
const checkEmail = async (email: string) => {
|
||||
if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
if (!email || !isValidEmail(email)) {
|
||||
setEmailStatus({ checking: false, exists: null, valid: null, message: '' });
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user